Re: Show sequences owned by

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Show sequences owned by
Date: 2011-11-04 14:12:19
Message-ID: CABUevEwhJ30vQyJHGpW+E9-goVvbSeKBK8dSa-h98jZhhDte1A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 4, 2011 at 15:09, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
> Magnus,
>
> * Magnus Hagander (magnus(at)hagander(dot)net) wrote:
>> The attached patch makes the \d output for psql on a sequence show
>> which table/column owns the sequence. The table already showed the
>> dependency the other way through the default value, but going from
>> sequence back to table was not possible.
>
> Seems reasonable.
>
>> Comments/reviews?
>
> Not sure if that 'goto error_return;' handles this correctly, but it
> would seem like you're missing the possibility that a sequence isn't
> owned by any table/column..?  Or that it could be depended upon by more
> than one table/column?  Both of those happen and are perfectly valid
> situations for a sequence to be in..

If there is noone owning it at all, it just falls through the if/else
block and ignores it if that happens (PQntuples() returns 0).

Is there really a case for multiple sequences to own it? How would you
go about making that happen? ALTER SEQUENCE.. OWNED BY.. only takes
one table, afaics?

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2011-11-04 14:13:30 Re: Show statistics target in \d+
Previous Message Stephen Frost 2011-11-04 14:12:00 Re: Show statistics target in \d+