Re: OID Usage - Mailing list pgsql-general

From Michael Fuhr
Subject Re: OID Usage
Date
Msg-id 20050115173504.GA1536@winnie.fuhr.org
Whole thread Raw
In response to Re: OID Usage  (Bo Lorentsen <bl@netgroup.dk>)
List pgsql-general
On Sat, Jan 15, 2005 at 05:53:08PM +0100, Bo Lorentsen wrote:
> Michael Fuhr wrote:
>
> >The view assumes single-column primary keys defined as SERIAL types.
> >
> is this the "c2.relkind = 'S'" in the view ?

That restricts the view to show only dependent objects that are
sequences ('S').  Defining a column as SERIAL puts a row in pg_depend
that establishes the link between the table and the sequence; if
you explicitly create a sequence and declare the primary key to be
INTEGER with a default value of nextval('sequence_name') then you
don't get the pg_depend link, even though that method is functionally
equivalent to SERIAL.  So the view is flawed in that it won't show
a row for the latter case, hence my warning about the view's
assumption.

Other methods are possible.  One way might involve joining with
pg_attrdef and extracting the sequence name from the adsrc column.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: OID Usage
Next
From: Tom Lane
Date:
Subject: Re: PQisBusy() always returns TRUE