Thread: Addition of alias types regpublication and regsubscription

Addition of alias types regpublication and regsubscription

From
vignesh C
Date:
Hi,

I felt inclusion of alias types regpublication and regsubscription will help the logical replication users. This will also help in [1].
The alias types allow simplified lookup of publication oid values for objects. For example, to examine the pg_publication_rel rows, one could write:
SELECT prpubid::regpublication, prrelid::regclass FROM pg_publication_rel;

rather than:
SELECT p.pubname, prrelid::regclass FROM pg_publication_rel pr, pg_publication p WHERE pr.prpubid = p.oid;

Similarly in case of subscription:
For example, to examine the pg_subscription_rel rows, one could write:
SELECT srsubid::regsubscription, srrelid::regclass FROM pg_subscription_rel;

rather than:
SELECT s.subname,srsubid::regclass FROM pg_subscription_rel sr, pg_subscription s where sr.srsubid = s.oid;

Attached patch has the changes for the same.
Thoughts?

[1] - https://www.postgresql.org/message-id/flat/CALDaNm0OANxuJ6RXqwZsM1MSY4s19nuH3734j4a72etDwvBETQ%40mail.gmail.com

Regards,
Vignesh
Attachment

Re: Addition of alias types regpublication and regsubscription

From
Tom Lane
Date:
vignesh C <vignesh21@gmail.com> writes:
> I felt inclusion of alias types regpublication and regsubscription will
> help the logical replication users.

This doesn't really seem worth the trouble --- how often would you
use these?

If we had a policy of inventing reg* aliases for every kind of catalog
object, that'd be one thing, but we don't.  (And the overhead in
inventing new object kinds is already high enough, so I'm not in favor
of creating such a policy.)

            regards, tom lane



Re: Addition of alias types regpublication and regsubscription

From
vignesh C
Date:
On Sat, May 29, 2021 at 9:10 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> vignesh C <vignesh21@gmail.com> writes:
> > I felt inclusion of alias types regpublication and regsubscription will
> > help the logical replication users.
>
> This doesn't really seem worth the trouble --- how often would you
> use these?
>
> If we had a policy of inventing reg* aliases for every kind of catalog
> object, that'd be one thing, but we don't.  (And the overhead in
> inventing new object kinds is already high enough, so I'm not in favor
> of creating such a policy.)

ok, Thanks for considering this.

Regards,
Vignesh