Re: CREATE TABLE with a column of type {table name}
От | Stephan Szabo |
---|---|
Тема | Re: CREATE TABLE with a column of type {table name} |
Дата | |
Msg-id | 20030731035231.J12915-100000@megazone.bigpanda.com обсуждение исходный текст |
Ответ на | CREATE TABLE with a column of type {table name} (Ang Chin Han <angch@bytecraft.com.my>) |
Ответы |
Re: CREATE TABLE with a column of type {table name}
|
Список | pgsql-general |
On Thu, 31 Jul 2003, Ang Chin Han wrote: > In Postgresql 7.3, a datatype can be int, text, etc, and also > pseudo-types like RECORD, any, etc. > > These pseudo types are mainly used in CREATE FUNCTIONs, but what if it's > used in a CREATE TABLE, esp. when the name of another table is used as a > datatype? [...] > > -- Hmmm... What if pseudo-types in CREATE TABLEs? > -- *** THIS IS THE WHAT I'M INTERESTED IN *** > CREATE TABLE bar(myfoo foo, c int); > > -- The only way I can think of to insert values into the table bar: > SELECT INTO bar SELECT get_foo1(), 1; You can write casts as well presumably to allow other inputs. > -- How to retrieve data from bar? > SELECT * FROM bar; > ERROR: Cannot display a value of type RECORD > > SELECT myfoo.a FROM bar; > ERROR: Attribute "myfoo.a" not found However the syntax select a(myfoo),b(myfoo) from bar should work.
В списке pgsql-general по дате отправления: