better error handling for COPY from stdin

Поиск
Список
Период
Сортировка
От hubert depesz lubaczewski
Тема better error handling for COPY from stdin
Дата
Msg-id 20080422140217.GA12194@depesz.com
обсуждение исходный текст
Список pgsql-general
if you have .sql file with COPY table FROM stdin;
and the table doesn't exist, psql prints a lot of errors from lines
which contain only data for copy.

to reproduce:
=> echo -ne "COPY non_existing_table FROM stdin;\n1\n\\N\n2\n\\.\n" | psql
ERROR:  relation "non_existing_table" does not exist
invalid command \N
invalid command \.
ERROR:  syntax error at or near "1"
LINE 1: 1
        ^

would it be possible to make it smarter, so it will not treat datalines from
failed copy as statements?

i see a lot of questions that "postgresql says command \N is invalid" - which
is of course rubbish, but making psql a bit smarter would make all of these
question go away.

regards,

depesz

--
quicksil1er: "postgres is excellent, but like any DB it requires a
highly paid DBA.  here's my CV!" :)
http://www.depesz.com/ - blog dla ciebie (i moje CV)

В списке pgsql-general по дате отправления:

Предыдущее
От: Joris Dobbelsteen
Дата:
Сообщение: Re: table as log (multiple writers and readers)
Следующее
От: Erik Jones
Дата:
Сообщение: Re: How is statement level read consistency implemented?