Help needed in skipping column for copy command

Поиск
Список
Период
Сортировка
От Amar Dhole
Тема Help needed in skipping column for copy command
Дата
Msg-id B290BFEC59278744B17A7A3CB14307E90387304A@NA-PA-VBE04.na.tibco.com
обсуждение исходный текст
Ответ на Re: help needs in converting db2 function in postgresql.  ("Amar Dhole" <adhole@tibco.com>)
Ответы Re: Help needed in skipping column for copy command  (Adrian Klaver <adrian.klaver@gmail.com>)
Re: Help needed in skipping column for copy command  (Russell Galyon <russellgalyon@gmail.com>)
Список pgsql-sql

I have table created as follows

 

 

CREATE TABLE D_2147483927_2147484848_TAB(

CP  VARCHAR(256) ,

CPR VARCHAR(256) ,

CHOUSENO VARCHAR(256) ,

CSTREET VARCHAR(256) ,

CLOCALITY VARCHAR(256) ,

CCITY VARCHAR(256) ,

CPROVINCE VARCHAR(256) ,

CCOUNTRY VARCHAR(256) ,

CZIP VARCHAR(256) ,

CCO VARCHAR(256) )

 

I am using copy command to copy the content of file into the table. (one.txt)

           

PR,PRO,HOUSENO,STREET,LOCALITY,CITY,PROVINCE,COUNTRY,ZIP,CON

,,A-24 Siddi vihar apt.,Near Krishna Chowk,New Sanghvi,Pune,MH,India,411027

 

 

In the above data, data for last column is missing.

 

 

copy D_2147483927_2147484848_TAB from 'D:/work/one.txt' with delimiter as ',' quote '"'  csv HEADER  ;

 

 

I get the following error as

 

ERROR:  missing data for column "ccontains"

CONTEXT:  COPY d_2147483927_2147484848_tab, line 2: "q,q,A-24 Siddi vihar apt.,

Near Krishna Chowk,New Sanghvi,Pune,MH,India,411027 "

 

Can any one please tell me how can I make copy command to ignore the data missing column ? as the data in file is unknown so it column name is which is missing is not known in advance.

 

Thanks

Amar

 

В списке pgsql-sql по дате отправления:

Предыдущее
От: Marcin Mirosław
Дата:
Сообщение: Re: failing to connect to postgresql with php
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Help needed in skipping column for copy command