dump data into complex type table

From: windwxc(at)sina(dot)com
To: pgsql-general(at)postgresql(dot)org
Subject: dump data into complex type table
Date: 2008-04-05 02:41:21
Message-ID: 20080405024121.DE4BB1EE96A@mail3-145.sinamail.sina.com.cn
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hi,everyone,first thank you help me relove the problem about complex type.
now i have other two question about complex type field.
firstly, i want to know if the complex type data can be dump into the database by command 'copy'?
secondly, i try it but failure. The following is detail about my operation. my data which need be dump into data is text file and the table accepting the data is include a complex type field.
format of text file is :
"dd",20,"1,"010301040213","石红","红河州弥勒县虹溪镇虹溪村委会东门村小组","K236","(2005-1-1,2005-12-31)""
"ww",2,"2,"010301010975","陈永华","红河州弥勒县虹溪镇虹溪村委会西门村小组","K236","(2005-1-1,2005-12-31)""
my table is:
CREATE TABLE test2
(
address character varying(30),
area1 numeric,
att attritest
)
WITH (OIDS=FALSE);
ALTER TABLE test2 OWNER TO stuser;

attritest is complex type and define is:
CREATE TYPE attritest AS(ID integer, planter_no character(20).planter_name character(20),planter_address character varying(50),planter_type character(10), validtime lifetime);
lifetime also complex type and includes (starttime date,endtime date)
my COPY commamn is:
copy test2 from 'e:\\test.txt' with DELIMITE ',';
the error is:
ERROR: extra data afterlase expected column.
thank you!
xiaochun wu

-------------------------------------------------------------------
外企高薪职位急聘( http://d1.sina.com.cn/sina/limeng3/mail_zhuiyu/2008/mail_zhuiyu_20080331.html )

-------------------------------------------------------------------
注册新浪2G免费邮箱(http://mail.sina.com.cn/)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Aidan Van Dyk 2008-04-05 02:59:44 Re: modules
Previous Message Andrew Dunstan 2008-04-05 01:53:56 Re: modules