Re: OID Usage

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Bo Lorentsen <bl(at)netgroup(dot)dk>
Cc: "pgsql-general postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: OID Usage
Date: 2005-01-15 17:35:04
Message-ID: 20050115173504.GA1536@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-01-15 17:45:27 Re: PQisBusy() always returns TRUE
Previous Message Alvaro Herrera 2005-01-15 17:31:23 Re: OID Usage