Search Postgresql Archives

better error handling for COPY from stdin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux