Re: Inverse of pg_get_serial_sequence?
От | David G Johnston |
---|---|
Тема | Re: Inverse of pg_get_serial_sequence? |
Дата | |
Msg-id | 1409360138529-5816993.post@n5.nabble.com обсуждение исходный текст |
Ответ на | Inverse of pg_get_serial_sequence? (Andres Freund <andres@2ndquadrant.com>) |
Ответы |
Re: Inverse of pg_get_serial_sequence?
|
Список | 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.
В списке pgsql-hackers по дате отправления: