| From: | Philip Alger <paalger0(at)gmail(dot)com> | 
|---|---|
| To: | Quan Zongliang <quanzongliang(at)yeah(dot)net> | 
| Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Re: [PATCH] Add pg_get_type_ddl() to retrieve the CREATE TYPE statement | 
| Date: | 2025-10-31 01:34:48 | 
| Message-ID: | CAPXBC8JxucG=m=Pnjb7-dLf5iqxcfA92-8UOEaNY1qDPH9dW3Q@mail.gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
Hi Quan,
This is part of a larger project as noted here:
> I am submitting a patch as part of the Retail DDL functions project
> > described here [1].
>
> > 1. https://www.postgresql.org/message-id/945db7c5-be75-45bf-b55b-
> > cb1e56f2e3e9%40dunslane.net <https://www.postgresql.org/message-
> > id/945db7c5-be75-45bf-b55b-cb1e56f2e3e9%40dunslane.net>
>
The idea here is to look up the created TYPE by its name and not the OID.
The function that is close is pg_get_viewdef(text) [1], but that's
deprecated.
 Also, see threads for:
A. pg_get_trigger_ddl [2]
B. pg_get_tablespace_ddl [3]
C. pg_get_role_ddl [4]
D. pg_get_policy_ddl [5]
E. pg_get_domain_ddl [6]
1.https://www.postgresql.org/docs/18/functions-info.html
2.
https://www.postgresql.org/message-id/flat/CAPXBC8K5awmtMoq66DGHe%2BnD7hUf6HPRVHLeGNBRpCDpzusOXQ%40mail.gmail.com
3.
https://www.postgresql.org/message-id/flat/CAKWEB6rmnmGKUA87Zmq-s%3Db3Scsnj02C0kObQjnbL2ajfPWGEw%40mail.gmail.com
4.
https://www.postgresql.org/message-id/flat/4c5f895e-3281-48f8-b943-9228b7da6471%40gmail.com
5.
https://www.postgresql.org/message-id/flat/CANxoLDdJsRJqnjMXV3yjsk07Z5iRWxG-c2hZJC7bAKqf8ZXj_A%40mail.gmail.com
6.
https://www.postgresql.org/message-id/flat/CAPgqM1URzR017U5gEK6S5dYz8VdYMaJf82G9sZFq5xbpHR1J_g%40mail.gmail.com#b1acf1f04ba8b36239fccdfae0110d3d
-- 
Best,
Phil Alger
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Smith | 2025-10-31 02:04:16 | Re: Logical Replication of sequences | 
| Previous Message | Quan Zongliang | 2025-10-31 00:54:30 | Re: [PATCH] Add pg_get_type_ddl() to retrieve the CREATE TYPE statement |