Re: Problems on "copy" statement

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Leung Wing Lap Ellery <lap01(at)netvigator(dot)com>
Cc: Keith Worthington <keithw(at)narrowpathinc(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Problems on "copy" statement
Date: 2005-04-13 16:39:37
Message-ID: 20050413163937.GA91790@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Mark Lewis 2005-04-13 16:42:29 Re: [PERFORM] Many connections lingering
Previous Message Sean Davis 2005-04-13 16:37:01 Re: Problems on "copy" statement