about complex type

From: windwxc(at)sina(dot)com
To: pgus-general(at)postgresql(dot)org
Subject: about complex type
Date: 2008-04-03 02:10:24
Message-ID: 20080403021024.0F1741EE8AB@mail3-145.sinamail.sina.com.cn
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgus-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.
                                                                                                   wuxiaochun

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

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

Responses

Browse pgus-general by date

  From Date Subject
Next Message Joshua D. Drake 2008-04-03 02:31:53 Re: about complex type
Previous Message Joshua D. Drake 2008-03-19 18:44:32 test