From: | David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Inverse of pg_get_serial_sequence? |
Date: | 2014-08-30 00:55:38 |
Message-ID: | 1409360138529-5816993.post@n5.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2014-08-30 01:03:12 | Re: Inverse of pg_get_serial_sequence? |
Previous Message | Brightwell, Adam | 2014-08-30 00:16:46 | Re: RLS Design |