how to insert values into complex type field

From: windwxc(at)sina(dot)com
To: pgsql-general(at)postgresql(dot)org
Subject: how to insert values into complex type field
Date: 2008-04-04 08:32:36
Message-ID: 20080404083236.A88EF1EE8E2@mail3-145.sinamail.sina.com.cn
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hi all, i want to know how to insert values into the field which is a complex type. In fact it is a complex type which also include a complex type. The following is its definition:
create TYPE lifetime as( strattime date, endtime date);
create TYPE attributetype as( ID numeric, address character(50), periodspan lifetime);
create TABLE attribute2005( gid serial, allfield attributetype);
now i want to insert data into the table attribute2005 but always failure so wish someone can help.
my sql is following:
INSERT INTO attribute2005 VALUES(1,(23,'ee','ttt',('2005-01-01','2005-12-31')));
my postgresql is 8.2 and is installed in windows XP.
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 Tom Dunstan 2008-04-04 08:53:31 Re: modules
Previous Message A. Kretschmer 2008-04-04 07:49:42 Re: Autograph Annoucement (ERD Tool)