question about complex type

From: windwxc(at)sina(dot)com
To: pgsql-general(at)postgresql(dot)org
Subject: question about complex type
Date: 2008-04-03 11:13:43
Message-ID: 20080403111343.E97EF1EEA02@mail3-145.sinamail.sina.com.cn
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hi, now i meet a question about the complex field. Firstly i create a complex type (the sql is "CREATE TYPE test11 as (area numeric, address character varying(30))")and then i create a table ,set a field named "tt" whose type is test11. Now i want insert the data which select from another talble yantian_2005 into the tt of test1. but i try some SQL and always failure. so i wish you can tell me how to do .The following is my sql and their error.
(1)select (eid,address,area1,marea,shape_area,shape_len,the_geom,gid)into table1 from yantian_2005 where gid=2
ERROR:  column "row" has pseudo-type record
(2)insert into test1(tt)select row(yantian_2005.address, yantian_2005.area1 )from yantian_2005 where gid=3;
ERROR:  cannot cast type record to test11
(3)select Row (yantian_2005.address,yantian_2005.area1)::{tt} into table1 from yantian_2005 where gid=2
ERROR:  syntax error at or near "{"
LINE 1: ...ct Row (yantian_2005.address,yantian_2005.area1)::{tt} into ...
please tell me how to do.
my postgresql is 8.2 and system is windows XP.
                                                              xiaochun wu

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

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

Browse pgsql-general by date

  From Date Subject
Next Message Zeugswetter Andreas OSB SD 2008-04-03 11:33:42 Re: modules
Previous Message Ivan Sergio Borgonovo 2008-04-03 10:28:43 is it helpful for the optimiser/planner to add LIMIT 1