Re: Show sequences owned by

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Show sequences owned by
Date: 2011-11-04 14:19:45
Message-ID: 6756.1320416385@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Magnus Hagander <magnus(at)hagander(dot)net> writes:
> 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.

> Comments/reviews?

The join conditions are far from adequate. You can *not* just check the
objid, you *must* check classid (and refclassid) to avoid being fooled
by duplicate OIDs in different system catalogs. You've also not held
to psql's normal conventions about fully qualifying names to avoid
making assumptions about the search_path.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-11-04 14:21:43 Re: pg_dump --exclude-table-data
Previous Message Cédric Villemain 2011-11-04 14:14:22 Re: Show statistics target in \d+