Recursive types?

From: "John Hansen" <john(at)geeknet(dot)com(dot)au>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: Recursive types?
Date: 2005-04-11 10:54:46
Message-ID: 5066E5A966339E42AA04BA10BA706AE5628F@rodrick.geeknet.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Consider the following:

create table foo ( id serial primary key, path text);
alter table foo add ref foo;

Table "public.foo"
Column | Type | Modifiers
--------+---------+-----------------------------------------------------
id | integer | not null default nextval('public.foo_id_seq'::text)
path | text |
ref | foo |
Indexes:
"foo_pkey" PRIMARY KEY, btree (id)

insert into foo (path) VALUES ('/');
insert into foo (path,ref) VALUES ('/foo',ROW(1,'/',NULL));
insert into foo (path,ref) VALUES
('/foo/bar',ROW(2,'/foo',ROW(1,'/',NULL)));

select * from foo;
id | path | ref
----+----------+-------------------
1 | / |
2 | /foo | (1,/,)
3 | /foo/bar | (2,/foo,"(1,/,)")
(3 rows)

However, it is not possible to create such a type using create type, as
there is no alter type, even tho alter table does the same thing.

Is this a bug or a random feature?

It is also not possible to dump and restore this using pg_dump.

... John

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Reinhard Max 2005-04-11 12:46:09 probably needless linking against readline and ncurses
Previous Message Tom Lane 2005-04-11 06:49:06 Re: Question regarding clock-sweep