Thread: BUG #1770: Composite type dependency broken

BUG #1770: Composite type dependency broken

From
"David Fetter"
Date:
The following bug has been logged online:

Bug reference:      1770
Logged by:          David Fetter
Email address:      david@fetter.org
PostgreSQL version: 8.0.3
Operating system:   Linux
Description:        Composite type dependency broken
Details:

Here's a repro (psql):

create table foo (foo_id SERIAL PRIMARY KEY, foo_text TEXT NOT NULL);
CREATE type two_foos AS (foo1 foo, foo2 foo);
CREATE type four_foos AS (two_foo1 two_foos, two_foo2 two_foos);
DROP TABLE foo CASCADE;

Perhaps I have misunderstood, but I would think that both two_foos and
four_foos would disappear as a result of this.  They don't :/

Cheers,
D

Re: BUG #1770: Composite type dependency broken

From
Stephan Szabo
Date:
On Fri, 15 Jul 2005, David Fetter wrote:

> Here's a repro (psql):
>
> create table foo (foo_id SERIAL PRIMARY KEY, foo_text TEXT NOT NULL);
> CREATE type two_foos AS (foo1 foo, foo2 foo);
> CREATE type four_foos AS (two_foo1 two_foos, two_foo2 two_foos);
> DROP TABLE foo CASCADE;
>
> Perhaps I have misunderstood, but I would think that both two_foos and
> four_foos would disappear as a result of this.  They don't :/

I think the current definition is that the columns of the removed type
disappear, which means two_foos becomes a type with no columns rather than
it being removed.

Re: BUG #1770: Composite type dependency broken

From
Tom Lane
Date:
"David Fetter" <david@fetter.org> writes:
> create table foo (foo_id SERIAL PRIMARY KEY, foo_text TEXT NOT NULL);
> CREATE type two_foos AS (foo1 foo, foo2 foo);
> CREATE type four_foos AS (two_foo1 two_foos, two_foo2 two_foos);
> DROP TABLE foo CASCADE;

> Perhaps I have misunderstood, but I would think that both two_foos and
> four_foos would disappear as a result of this.  They don't :/

No; their columns disappear, but the types don't.  This is just the same
as not trashing an entire table when a single column's type is dropped
--- that propagates as a DROP COLUMN, not a DROP TABLE.

            regards, tom lane