Re: [HACKERS] Definitional questions for pg_sequences view - Mailing list pgsql-hackers

From Craig Ringer
Subject Re: [HACKERS] Definitional questions for pg_sequences view
Date
Msg-id CAMsr+YFpt0V-8tSRM=dtsALZj-ZhdpHEoCatx3qBGEDgwGDpXw@mail.gmail.com
Whole thread Raw
In response to [HACKERS] Definitional questions for pg_sequences view  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 20 July 2017 at 22:36, Tom Lane <tgl@sss.pgh.pa.us> wrote:

This could be fixed if it were possible to translate to
        select * from pg_sequences where seqoid = 'my_seq'::regclass;
but the view isn't exposing the sequence OID.  Should it?

It probably should. It's not part of information_schema, it's in pg_catalog, and it's entirely reasonable to join on oids.

The relfilenode for the sequence can change, but the sequence oid won't unless we actually drop and re-create it, so the weird issues with alter sequence operations being partly transactional and partly not shouldn't be a concern.

If it's to be a convenience view, it should possibly also expose the OWNED BY relation oid IMO, if any. You have the sequence oid you can join on pg_class and grab the relowner, so it's not a great hassle if it's missing, but if it's a view to help users out exposing that would seem sensible.


--
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: [HACKERS] More optimization effort?
Next
From: Craig Ringer
Date:
Subject: Re: [HACKERS] xlogfilename