Re: about complex type

Lists: Postg롤 토토SQL
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
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/)


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: windwxc(at)sina(dot)com
Cc: pgus-general(at)postgresql(dot)org
Subject: Re: about complex type
Date: 2008-04-03 02:31:53
Message-ID: 20080402193153.4d6121fe@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg롤 토토SQL

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, 03 Apr 2008 10:10:24 +0800
windwxc(at)sina(dot)com wrote:

Hello,

This is off topic for this list. Please try pgsql-novice or
pgsql-general.

Thanks,

Sincerely,

Joshua D. Drake

> 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:&nbsp; 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:&nbsp; 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:&nbsp; 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.
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> wuxiaochun
>
> -------------------------------------------------------------------
> 外企高薪职位急聘( http://d1.sina.com.cn/sina/limeng3/mail_zhuiyu/2008/mail_zhuiyu_20080331.html )
>
> -------------------------------------------------------------------
> 注册新浪2G免费邮箱(http://mail.sina.com.cn/)

- --
The PostgreSQL Company since 1997: http://www.commandprompt.com/
PostgreSQL Community Conference: http://www.postgresqlconference.org/
United States PostgreSQL Association: http://www.postgresql.us/
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFH9EGZATb/zqfZUUQRAnrjAKCS8NPNk/AdqwTs6bgp5zt9xRQQ+QCeNB5f
JdJpnrEZ3lY7asDRJGQpYXc=
=ygx5
-----END PGP SIGNATURE-----