Addition of alias types regpublication and regsubscription

From: vignesh C <vignesh21(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Addition of alias types regpublication and regsubscription
Date: 2021-05-29 15:29:16
Message-ID: CALDaNm27iKiOSODjudjfSZ4kPfnhwqWricWrgm9U7Oiv4S62mw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 Content-Type Size
v1-0001-Implement-type-regpublication.patch application/x-patch 16.0 KB
v1-0002-Implement-type-regsubscription.patch application/x-patch 16.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2021-05-29 15:38:30 Re: CREATE COLLATION - check for duplicate options and error out if found one
Previous Message Tom Lane 2021-05-29 14:44:14 Re: be-secure-gssapi.c and auth.c with setenv() not compatible on Windows