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

Re: Recursive containment of composite types

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Recursive containment of composite types
Date: 2011-03-28 15:14:23
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Merlin Moncure <mmoncure(at)gmail(dot)com> writes:
>> On Mon, Mar 28, 2011 at 9:47 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> I think the most straightforward and reliable fix for this would be to
>>> forbid recursive containment of a rowtype in itself --- ie, the first
>>> ALTER should have been rejected. Can anyone think of a situation where
>>> it would be sane to allow such a thing?

>> Well, maybe. In fact, probably. That's like asking in C if it's sane
>> to have a structure to contain a pointer back to itself, which of
>> course it is. That said, if it doesn't work properly, it should
>> probably be disabled until it does.

> hm, you can work around lack of above at present using two vs one types:
> postgres=# create table b ();
> postgres=# create table c ();
> postgres=# alter table b add c c;
> postgres=# alter table c add b b;

Well, that'd have to be disallowed too under what I have in mind.
Indirect recursion is no safer than direct.  If you try

alter table b add k serial;

at this point, you'll get the same crash or failure as for the direct
recursion case.

			regards, tom lane

In response to


pgsql-hackers by date

Next:From: Robert HaasDate: 2011-03-28 15:15:28
Subject: Re: Additional options for Sync Replication
Previous:From: hubert depesz lubaczewskiDate: 2011-03-28 15:11:48
Subject: Re: Problem with streaming replication, backups, and recovery (9.0.x)

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