Isn't this a bug?

regression=# create table FOO (f1 int);
CREATE TABLE
regression=# \copy FOO from stdin
ERROR:  Relation "FOO" does not exist
\copy: ERROR:  Relation "FOO" does not exist
regression=#

This happens because \copy takes the given table name and slaps
double quotes around it, so the backend gets COPY "FOO" ...
rather than COPY FOO ...

It seems to me that psql's \copy should interpret the table name
the same way that a regular SQL command would: honor double quotes,
downcase in the absence of quotes.

Comments, objections?

			regards, tom lane

Sat, 12 Oct 2002 16:57:42 -0400
Tom Lane <tgl@sss.pgh.pa.us>
\copy and identifier quoting
Tom Lane wrote:
> Isn't this a bug?
> 
> regression=# create table FOO (f1 int);
> CREATE TABLE
> regression=# \copy FOO from stdin
> ERROR:  Relation "FOO" does not exist
> \copy: ERROR:  Relation "FOO" does not exist
> regression=#
> 
> This happens because \copy takes the given table name and slaps
> double quotes around it, so the backend gets COPY "FOO" ...
> rather than COPY FOO ...
> 
> It seems to me that psql's \copy should interpret the table name
> the same way that a regular SQL command would: honor double quotes,
> downcase in the absence of quotes.
> 
> Comments, objections?

Yes, that makes perfect sense.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Sun, 13 Oct 2002 23:46:10 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: \copy and identifier quoting