pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
copy command and column attribute
3+ messages / 2 participants
[nested] [flat]

* copy command and column attribute
@ 2009-03-30 14:39 toni hernández <toni@sigte.udg.edu>
  2009-03-30 15:40 ` Re: copy command and column attribute Guillaume Lelarge <guillaume@lelarge.info>
  0 siblings, 1 reply; 3+ messages in thread

From: toni hernández @ 2009-03-30 14:39 UTC (permalink / raw)
  To: pgsql-admin

hi all,

I've been trying to import some data from a csv file to my database.
I have some fields of the table that I want to keep so I typed

copy mytable (column 
Affidabilita_stratigrafica,Ambiente,Anno,Componenti_geologici) FROM 
E'c://export_us_sg4.csv' with delimiter ',' csv quote as '"';

This way I expect some fields to remain with the default value, but an 
error appears near "column"

Am I typing it wrong?




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: copy command and column attribute
  2009-03-30 14:39 copy command and column attribute toni hernández <toni@sigte.udg.edu>
@ 2009-03-30 15:40 ` Guillaume Lelarge <guillaume@lelarge.info>
  2009-03-31 07:39   ` Re: copy command and column attribute toni hernández <toni@sigte.udg.edu>
  0 siblings, 1 reply; 3+ messages in thread

From: Guillaume Lelarge @ 2009-03-30 15:40 UTC (permalink / raw)
  To: pgsql-admin; +Cc: toni hernández <toni@sigte.udg.edu>

Le lundi 30 mars 2009 à 16:39:59, toni hernández a écrit :
> [...]
> I've been trying to import some data from a csv file to my database.
> I have some fields of the table that I want to keep so I typed
>
> copy mytable (column
> Affidabilita_stratigrafica,Ambiente,Anno,Componenti_geologici) FROM
> E'c://export_us_sg4.csv' with delimiter ',' csv quote as '"';
>
> This way I expect some fields to remain with the default value, but an
> error appears near "column"
>
> Am I typing it wrong?

Yes, there should be no COLUMN keyword in this statement.

copy mytable (Affidabilita_stratigrafica,Ambiente,Anno,Componenti_geologici)
FROM E'c://export_us_sg4.csv' with delimiter ',' csv quote as '"';

This should work better.


-- 
Guillaume.
 http://www.postgresqlfr.org
 http://dalibo.com



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: copy command and column attribute
  2009-03-30 14:39 copy command and column attribute toni hernández <toni@sigte.udg.edu>
  2009-03-30 15:40 ` Re: copy command and column attribute Guillaume Lelarge <guillaume@lelarge.info>
@ 2009-03-31 07:39   ` toni hernández <toni@sigte.udg.edu>
  0 siblings, 0 replies; 3+ messages in thread

From: toni hernández @ 2009-03-31 07:39 UTC (permalink / raw)
  To: pgsql-admin


Thanks a lot Guillaume,

It worked!!

Guillaume Lelarge escribió:
> Le lundi 30 mars 2009 à 16:39:59, toni hernández a écrit :
>   
>> [...]
>> I've been trying to import some data from a csv file to my database.
>> I have some fields of the table that I want to keep so I typed
>>
>> copy mytable (column
>> Affidabilita_stratigrafica,Ambiente,Anno,Componenti_geologici) FROM
>> E'c://export_us_sg4.csv' with delimiter ',' csv quote as '"';
>>
>> This way I expect some fields to remain with the default value, but an
>> error appears near "column"
>>
>> Am I typing it wrong?
>>     
>
> Yes, there should be no COLUMN keyword in this statement.
>
> copy mytable (Affidabilita_stratigrafica,Ambiente,Anno,Componenti_geologici)
> FROM E'c://export_us_sg4.csv' with delimiter ',' csv quote as '"';
>
> This should work better.
>
>
>   



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2009-03-31 07:39 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-03-30 14:39 copy command and column attribute toni hernández <toni@sigte.udg.edu>
2009-03-30 15:40 ` Guillaume Lelarge <guillaume@lelarge.info>
2009-03-31 07:39   ` toni hernández <toni@sigte.udg.edu>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox