question about complex type - Mailing list pgsql-general

From windwxc@sina.com
Subject question about complex type
Date
Msg-id 20080403111343.E97EF1EEA02@mail3-145.sinamail.sina.com.cn
Whole thread Raw
List 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/

pgsql-general by date:

Previous
From: Ivan Sergio Borgonovo
Date:
Subject: is it helpful for the optimiser/planner to add LIMIT 1
Next
From: Gregory Stark
Date:
Subject: Re: is it helpful for the optimiser/planner to add LIMIT 1