Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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.

外企高薪职位急聘( )



pgus-general by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group