Re: Problems on "copy" statement - Mailing list pgsql-novice

From Michael Fuhr
Subject Re: Problems on "copy" statement
Date
Msg-id 20050413163937.GA91790@winnie.fuhr.org
Whole thread Raw
In response to Re: Problems on "copy" statement  (Leung Wing Lap Ellery <lap01@netvigator.com>)
List pgsql-novice
On Thu, Apr 14, 2005 at 12:24:42AM +0800, Leung Wing Lap Ellery wrote:
>
> SELECT schemaname, tablename
> FROM pg_tables
> WHERE tablename ILIKE '%hsi%';
>
> get:
>
> schemaname     tablename
> public        HSI
>
> when run the sql:
>
> copy public.HSI from 'c:\java\hsi.txt'
>
> error:
>
> ERROR:  relation "public.hsi" does not exist

See the reference I posted about SQL identifiers, in particular
where it talks about quoted identifiers:

http://www.postgresql.org/docs/8.0/interactive/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS

Since the table name has uppercase letters, you'll have to quote
it.  And now that I think about it, you might also have to escape
the backslashes in the file name or use dollar quotes (available
in 8.0 and later).  Try one of these:

COPY "HSI" FROM 'c:\\java\\hsi.txt';
COPY "HSI" FROM $$c:\java\hsi.txt$$;

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

pgsql-novice by date:

Previous
From: Sean Davis
Date:
Subject: Re: Problems on "copy" statement
Next
From: "Keith Worthington"
Date:
Subject: Re: Problems on "copy" statement