Re: Problems on "copy" statement

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: lap01(at)netvigator(dot)com
Cc: PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Problems on "copy" statement
Date: 2005-04-13 16:37:01
Message-ID: 7f72eacca6a81188fc5ca7eb96a3a072@mail.nih.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

How about

COPY "HSI" from 'c:\java\hsi.txt'

You need the double quote to get the capitalization. I generally use
all lower-case so I don't have to think about it.

Sean

On Apr 13, 2005, at 12:24 PM, Leung Wing Lap Ellery wrote:

> Thanks for your reply.
>
> Run the sql:
>
> 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
>
>
>
> er...did I do something silly? What is the problem?
>
> Thanks in advance.
>
> Ellery Leung
>
>
> Michael Fuhr wrote:
>
>> On Wed, Apr 13, 2005 at 10:38:02AM -0400, Keith Worthington wrote:
>>
>>> On Wed, 13 Apr 2005 22:29:05 +0800, Leung Wing Lap Ellery wrote
>>>
>>>> copy hsi from 'c:\java\hsi.txt'
>>>>
>>>> it generated error:
>>>>
>>>> ERROR: relation "hsi" does not exist
>>>> copy hsi from 'c:\java\hsi.txt'
>>>>
>>> It seems to me that it cannot find the table. Try schema qualifying
>>> the
>>> tablename.
>>>
>>
>> Another possibility is that the table name is mixed-case -- if so,
>> then it'll have to be quoted.
>>
>> http://www.postgresql.org/docs/8.0/interactive/sql-syntax.html#SQL-
>> SYNTAX-IDENTIFIERS
>>
>> What's the result of the following query?
>>
>> SELECT schemaname, tablename
>> FROM pg_tables
>> WHERE tablename ILIKE '%hsi%';
>>
>>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to
> majordomo(at)postgresql(dot)org

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Fuhr 2005-04-13 16:39:37 Re: Problems on "copy" statement
Previous Message Keith Worthington 2005-04-13 16:36:09 Re: Problems on "copy" statement