Andres Freund-3 wrote > Hi, > > We have pg_get_serial_sequence() mapping (relation, colum) to the > sequence. What I'm missing right now is the inverse. I.e. given a > sequence tell me the owner. > describe.c has a query for that, and it's not too hard to write, but it > still seems 'unfriendly' not to provide it. > > Does anybody dislike adding a function for that? > > > I can't really think of a good name (not that pg_get_serial_sequence is > well named). pg_get_serial_sequence_owner(serial regclass, OUT rel > regclass, OUT colname name) maybe?
On a pure consistency basis: pg_get_sequence_serial(...) [though probably plural: _serials(...)] I'd drop the serial part altogether for the more appropriate: pg_get_sequence_ownedby(...) Given that ALTER SEQUENCE ... OWNED BY ... Is the corresponding SQL The inverse of what you proposed above would probably be more like: pg_get_owned_sequence(...) Reminder: sequences can be unowned. Ownership and usage via default are separate things though: do you have need to know all users of a sequence or only the single one that is defined as it's owner? pg_get_sequence_users(...) [or serials: as noted first] David J. -- View this message in context: http://postgresql.1045698.n5.nabble.com/Inverse-of-pg-get-serial-sequence-tp5816933p5816993.html Sent from the PostgreSQL - hackers mailing list archive at Nabble.com. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers