Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement

2025-11-09 Thread Akshay Joshi
Thanks for the clarification. However, I still believe this is out of scope for the CREATE POLICY DDL. The command ALTER TABLE ... ENABLE ROW LEVEL SECURITY seems more appropriate as part of the CREATE TABLE reconstruction rather than CREATE POLICY. That said, I’m open to adding it if the majority

Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement

2025-11-07 Thread Marcos Pegoraro
Em sex., 7 de nov. de 2025 às 11:27, Akshay Joshi < [email protected]> 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 tenan

Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement

2025-11-07 Thread Akshay Joshi
On Fri, Nov 7, 2025 at 6:45 PM Marcos Pegoraro wrote: > Em sex., 7 de nov. de 2025 às 09:21, Akshay Joshi < > [email protected]> escreveu: > >> Attached is the v7 patch, which is ready for review. >> >>> For this functionality to be complete, the >

Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement

2025-11-07 Thread Marcos Pegoraro
Em sex., 7 de nov. de 2025 às 09:21, Akshay Joshi < [email protected]> escreveu: > Attached is the v7 patch, which is ready for review. > >> >>> >>> For this functionality to be complete, the ALTER TABLE ... ENABLE ROW LEVEL SECURITY statement needs to be add

Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement

2025-11-07 Thread Akshay Joshi
Hi Hackers, Make the pretty flag a default parameter by adding CREATE OR REPLACE FUNCTION in system_functions.sql. Attached is the v7 patch, which is ready for review. On Mon, Nov 3, 2025 at 5:17 PM Akshay Joshi wrote: > Hi Hackers, > > Added a new #define GET_DDL_PRETTY_FLAGS because the exist

Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement

2025-11-03 Thread Akshay Joshi
Hi Hackers, Added a new #define GET_DDL_PRETTY_FLAGS because the existing #define GET_PRETTY_FLAGS is not suitable for formatting reconstructed DDLs. The existing #define GET_PRETTY_FLAGS always indents the code, regardless of whether the flag is set to true or false, which is not the desired beha

Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement

2025-10-28 Thread Akshay Joshi
Thanks, Mark, for your review comments and the updated patch. I’ve incorporated your changes and prepared a combined v5 patch. The v5 patch is attached for further review. On Mon, Oct 27, 2025 at 10:15 PM Mark Wong wrote: > Hi everyone, > > On Thu, Oct 16, 2025 at 01:47:53PM +0530, Akshay Joshi

Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement

2025-10-27 Thread Mark Wong
Hi everyone, On Thu, Oct 16, 2025 at 01:47:53PM +0530, Akshay Joshi wrote: > > > On Wed, Oct 15, 2025 at 10:55 PM Álvaro Herrera wrote: > > Hello, > > I have reviewed this patch before and provided a number of comments that > have been addressed by Akshay (so I encourage you to li

Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement

2025-10-24 Thread Akshay Joshi
On Thu, Oct 23, 2025 at 12:19 AM Philip Alger wrote: > > > >>> The get_formatted_string function is needed. Instead of using multiple >> if statements for the pretty flag, it’s better to have a generic >> function. This will be useful if the pretty-format DDL implementation is >> accepted by the

Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement

2025-10-22 Thread Philip Alger
>> The get_formatted_string function is needed. Instead of using multiple if > statements for the pretty flag, it’s better to have a generic function. > This will be useful if the pretty-format DDL implementation is accepted by > the community, as it can be reused by other pg_get__ddl() DDL > funct

Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement

2025-10-22 Thread Akshay Joshi
On Wed, Oct 22, 2025 at 12:51 PM jian he wrote: > On Thu, Oct 16, 2025 at 8:51 PM Akshay Joshi > wrote: > > > > Please find attached the v3 patch, which resolves all compilation errors > and warnings. > > > > drop table if exists t, ts, ts1; > create table t(a int); > CREATE POLICY p0 ON t FOR A

Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement

2025-10-22 Thread Akshay Joshi
On Tue, Oct 21, 2025 at 2:39 PM Chao Li wrote: > > > > On Oct 16, 2025, at 20:50, Akshay Joshi > wrote: > > > > Please find attached the v3 patch, which resolves all compilation errors > and warnings. > > > > On Thu, Oct 16, 2025 at 6:06 PM Philip Alger wrote: > > Hi Akshay, > > > > > > As for

Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement

2025-10-22 Thread jian he
On Thu, Oct 16, 2025 at 8:51 PM Akshay Joshi wrote: > > Please find attached the v3 patch, which resolves all compilation errors and > warnings. > drop table if exists t, ts, ts1; create table t(a int); CREATE POLICY p0 ON t FOR ALL TO PUBLIC USING (a % 2 = 1); SELECT pg_get_policy_ddl('t', 'p0'

Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement

2025-10-21 Thread Chao Li
> On Oct 16, 2025, at 20:50, Akshay Joshi wrote: > > Please find attached the v3 patch, which resolves all compilation errors and > warnings. > > On Thu, Oct 16, 2025 at 6:06 PM Philip Alger wrote: > Hi Akshay, > > > As for the statement terminator, it’s useful to include it, while runnin

[PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement

2025-10-18 Thread Akshay Joshi
Hi Hackers, I’m submitting a patch as part of the broader Retail DDL Functions project described by Andrew Dunstan https://www.postgresql.org/message-id/945db7c5-be75-45bf-b55b-cb1e56f2e3e9%40dunslane.net This patch adds a new system function pg_get_policy_ddl(table, policy_name, pretty), which r

Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement

2025-10-18 Thread Álvaro Herrera
Hello, I have reviewed this patch before and provided a number of comments that have been addressed by Akshay (so I encourage you to list my name and this address in a Reviewed-by trailer line in the commit message). One thing I had not noticed is that while this function has a "pretty" flag, it

Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement

2025-10-17 Thread Philip Alger
Hi Akshay, When applying the patch, I got a number of errors and the tests failed. I think it stems from: + targetTable = relation_open(tableID, NoLock); + relation_close(targetTable, NoLock); I changed them to use "AccessShareLock" and it worked, and it's probably relevant to change table_clos

Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement

2025-10-17 Thread jian he
hi. I still can not compile your v2. ../../Desktop/pg_src/src1/postgres/src/backend/utils/adt/ruleutils.c: In function ‘get_formatted_string’: ../../Desktop/pg_src/src1/postgres/src/backend/utils/adt/ruleutils.c:13770:9: error: function ‘get_formatted_string’ might be a candidate for ‘gnu_printf’

Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement

2025-10-17 Thread Philip Alger
Hi Akshay, >>> As for the statement terminator, it’s useful to include it, while >> running multiple queries together could result in a syntax error. In my >> opinion, there’s no harm in providing the statement terminator. >> > However, I’ve modified the logic to add the statement terminator at t

Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement

2025-10-17 Thread Akshay Joshi
On Wed, Oct 15, 2025 at 11:00 PM Philip Alger wrote: > Hi Akshay, > > When applying the patch, I got a number of errors and the tests failed. I > think it stems from: > > + targetTable = relation_open(tableID, NoLock); > + relation_close(targetTable, NoLock); > > > I changed them to use "AccessSh

Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement

2025-10-16 Thread Akshay Joshi
Please find attached the v3 patch, which resolves all compilation errors and warnings. On Thu, Oct 16, 2025 at 6:06 PM Philip Alger wrote: > Hi Akshay, > > As for the statement terminator, it’s useful to include it, while >>> running multiple queries together could result in a syntax error.

Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement

2025-10-16 Thread Akshay Joshi
On Wed, Oct 15, 2025 at 10:55 PM Álvaro Herrera wrote: > Hello, > > I have reviewed this patch before and provided a number of comments that > have been addressed by Akshay (so I encourage you to list my name and > this address in a Reviewed-by trailer line in the commit message). One > thing I