public inbox for pgsql-hackers@postgresql.org
help / color / mirror / Atom feedFrom: Marcos Pegoraro <marcos@f10.com.br>
To: Akshay Joshi <akshay.joshi@enterprisedb.com>
Cc: Mark Wong <markwkm@gmail.com>
Cc: Álvaro Herrera <alvherre@kurilemu.de>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement
Date: Fri, 7 Nov 2025 11:47:36 -0300
Message-ID: <CAB-JLwaDPJupWecAsvmNc7y7L5cQjV5P9epSFsTed1hEDbqUSA@mail.gmail.com> (raw)
In-Reply-To: <CANxoLDdV-ciaYqhWiZCRh3Nv+iW9o1LOGvS83TCZ=5X261OjNA@mail.gmail.com>
References: <CANxoLDdJsRJqnjMXV3yjsk07Z5iRWxG-c2hZJC7bAKqf8ZXj_A@mail.gmail.com>
<202510151529.s3fpwsgben57@alvherre.pgsql>
<CANxoLDfXKWRQ0KZFtaChr2NX3UWSQq3ji7OJqBp-_-th2Zj6Fg@mail.gmail.com>
<aP-hllbRdgqbmB8L@ltdrgnflg2>
<CANxoLDc8UnFuKA2RX6UR_KZWRH6itmrhXK7hoFyF=5kCyfFOGA@mail.gmail.com>
<CANxoLDfyk_+h91FNq5VNemXTBpES0aLPtLp2myTyWgquUHSQ3A@mail.gmail.com>
<CANxoLDfw=ERY89RR08s+qXwgUQvLCFF0pVG_e0fDT14rwZsWRg@mail.gmail.com>
<CAB-JLwYpfK3WCFJ1MT1sAB7Zj9w61wv7fMuCH2vZGW9W4JP15w@mail.gmail.com>
<CANxoLDdV-ciaYqhWiZCRh3Nv+iW9o1LOGvS83TCZ=5X261OjNA@mail.gmail.com>
Em sex., 7 de nov. de 2025 às 11:27, Akshay Joshi <
akshay.joshi@enterprisedb.com> escreveu:
> I don’t think we need that statement. Could you please elaborate on where
> exactly it needs to be added?
>
well, these pg_get_..._ddl() functions will be cool for compare/clone
schemas in a multi tenant world.
Instead of dump/sed/restore a schema to create a new one, I could use
something like
select pg_get_table_ddl(oid) from pg_class where nspname = 'customer_050'
and relkind = 'r' union all
select pg_get_constraint_ddl(oid) from pg_constraint inner join pg_class on
... where ... union all
select pg_get_trigger_ddl(oid) from pg_trigger inner join pg_class on
... where ... union all
...
And pg_get_policy_ddl() will be part of these union all selects
Because that would be good to worry about create that only if it does not
exists or drop first too.
regards
Marcos
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: marcos@f10.com.br, akshay.joshi@enterprisedb.com, markwkm@gmail.com, alvherre@kurilemu.de
Subject: Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement
In-Reply-To: <CAB-JLwaDPJupWecAsvmNc7y7L5cQjV5P9epSFsTed1hEDbqUSA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox