| From: | Paul Austin <paul(dot)austin(at)automutatio(dot)com> |
|---|---|
| To: | "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Extend CREATE POLICY to add IF EXISTS |
| Date: | 2025-10-20 22:19:12 |
| Message-ID: | CWXP265MB5009813E2DAA4D48F8C4A9F4F7F5A@CWXP265MB5009.GBRP265.PROD.OUTLOOK.COM |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Adrian,
The drop policy IF EXISTS does work.
But it would be nice to have the IF NOT EXISTS on CREATE POLICY so I don't need to do a drop and create.
________________________________
From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Sent: October 20, 2025 14:51
To: Paul Austin <paul(dot)austin(at)automutatio(dot)com>; pgsql-general(at)lists(dot)postgresql(dot)org <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Extend CREATE POLICY to add IF EXISTS
On 10/20/25 14:49, Paul Austin wrote:
> I forgot DROP POLICY already has IF EXISTS
I take it that works for you?
>
> *From:*Paul Austin <paul(dot)austin(at)automutatio(dot)com>
> *Sent:* October 20, 2025 2:46 PM
> *To:* pgsql-general(at)lists(dot)postgresql(dot)org
> *Subject:* Extend CREATE POLICY to add IF EXISTS
>
> Many (but not all) DDL statements use the pattern IF EXISTS or IF NOT
> EXISTS. This is really useful if you want to create a re-start-able data
> model update script without needing to have PL/pgSQL blocks that has
> checks to see if it exists.
>
> An example of a statement that doesn’t implement this pattern in the
> CREATE POLICY statement.
>
> Is there a plan to add this pattern to the rest of the DDL statements?
> Or could it be added to the CREATE/DROP POLICY statements?
>
> Thanks,
>
> Paul
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Álvaro Herrera | 2025-10-21 07:23:27 | Re: Extend CREATE POLICY to add IF EXISTS |
| Previous Message | Adrian Klaver | 2025-10-20 21:51:08 | Re: Extend CREATE POLICY to add IF EXISTS |