View Single Post

   
  #7 (permalink)  
Old 04-17-2008, 09:42 PM
Michael Fuhr
 
Posts: n/a
Default Re: Problems on "copy" statement

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/i...AX-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/

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply With Quote