Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vAyDp-008SZJ-PQ for pgsql-general@arkaria.postgresql.org; Mon, 20 Oct 2025 22:19:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1vAyDn-00508x-OV for pgsql-general@arkaria.postgresql.org; Mon, 20 Oct 2025 22:19:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vAyDn-00508j-C6 for pgsql-general@lists.postgresql.org; Mon, 20 Oct 2025 22:19:18 +0000 Received: from mail-uksouthazon11020137.outbound.protection.outlook.com ([52.101.196.137] helo=LO3P265CU004.outbound.protection.outlook.com) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vAyDj-003JHi-2X for pgsql-general@lists.postgresql.org; Mon, 20 Oct 2025 22:19:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Vl1Q4c60K+LfwJmPimLEw8NoJIQBp3alRc4xqbA8ubcebZuX0BXCFYQAp2QSO4Duu98GD/EXYmzUT847bzlsXfiAoQkmWdyIQnEtrbPb+zUmP902ZXLNOlD0o1MkIcuBXu1sgA9wkilba7nJWAyexLbS5jUFUR6xuyHsrwT95nLcxil/DRptNNxo5xywNzt4VBM9n/diWf7yew/kRdu0qBKfbOz/nNpRKnWQMaOcK25spen5kHywcMWfUZ5DWaWhYDCcopuEB8zldJ7PFQqKO3hAXuBVDcrRF7rCqje3ZQ/C1iPSC7ZkA9e3hRqay/+KZ8Vax9rIyEVq36AWHASL4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eb1u+0UP1YRIxyMuK/BfeRfHCZkyt0naQ2bjGu+DIpw=; b=Fx7vcQFY0HQpvlQawGCri9g272d9MFzs+ck7P4zQ5TDRkdfpdWjWnFe+/qGMMBgfUBphbgqaKqswYwg4ZjAIFHTLG35ItHYeFXgjOBNd7d3c3VvmMVhfJL44wurbivNCoamhwPEsLOkgCa47DWiCcyNTnNizxxc5bb79gEYnsQPDGddA76daJAEa17kdKyrsFHLbxYYHBZ107Rxq1FT5fLc0c/dOGfqFYbddk6Fjoy6Rn/IIKnBrI10QWRQ2zaHq+kKyYi5hwo8FP4Qmfih0Wd6HV24ldWCjKJzN7HdxB6AjtXXgP6N2rOFxZ9M9Cne7BYHlhyc+aXg8MD2xi4xvcg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=automutatio.com; dmarc=pass action=none header.from=automutatio.com; dkim=pass header.d=automutatio.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=automutatio.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eb1u+0UP1YRIxyMuK/BfeRfHCZkyt0naQ2bjGu+DIpw=; b=DCHRzZ2jSpV4fVCyzdxYvwpf1Ds/fxuZuudWHOlvb2FuQzA3qj59gQtryVKEqeorHcYPpAVvVlHgxtI8wRztNE1YMTttjtMEi0xtF7lCv8vEq9HfHA5radgdjec7OR5AhSzjH+k2yEz5WSVgElkteEqpIa/cVT/X6ppWZhUXw1d0EGjMWs7O6fGPypCs4aQrS1tAB4FLcu4sigHIoIxtckd2qRa1eFHPzkuNYOXDz3X5I/9/nB4lyPyAPyUJw61IICWF4y8N2Wf8XXDpyAal/zbgoMrTVGZp8BkVZiRqhMl5Kx3S1bpMcrUODoT6Y8BifbckOprDuiRHBeOtC8ofng== Received: from CWXP265MB5009.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:19a::5) by CWLP265MB1922.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:6c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9228.17; Mon, 20 Oct 2025 22:19:13 +0000 Received: from CWXP265MB5009.GBRP265.PROD.OUTLOOK.COM ([fe80::3e50:ef31:dd73:3bd2]) by CWXP265MB5009.GBRP265.PROD.OUTLOOK.COM ([fe80::3e50:ef31:dd73:3bd2%5]) with mapi id 15.20.9228.009; Mon, 20 Oct 2025 22:19:13 +0000 From: Paul Austin To: "pgsql-general@lists.postgresql.org" Subject: Re: Extend CREATE POLICY to add IF EXISTS Thread-Topic: Extend CREATE POLICY to add IF EXISTS Thread-Index: AdxCCtAMeEmhtA34RQC1mGZJuVgiUAAAICkgAAAU3AAAAOUOvQ== Date: Mon, 20 Oct 2025 22:19:12 +0000 Message-ID: References: <91c8bea5-b966-4cea-a303-c904feb5fd72@aklaver.com> In-Reply-To: <91c8bea5-b966-4cea-a303-c904feb5fd72@aklaver.com> Accept-Language: en-CA, en-US Content-Language: en-CA X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=automutatio.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CWXP265MB5009:EE_|CWLP265MB1922:EE_ x-ms-office365-filtering-correlation-id: 47651f12-65f9-4483-c883-08de1026b2f0 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|366016|1800799024|376014|8096899003|7053199007|38070700021; x-microsoft-antispam-message-info: =?Windows-1252?Q?/r7cZ0UwTrWyrAa2Hj0OQ3IOJ9amZr7WTQ1ziu1bSYRu15BeDVAJ79OT?= =?Windows-1252?Q?dUlH7o1Vxcuk9ODGoqnCmkTp7D2BMGCpzTXkwjDl5TbHrvvmSyMA5D3w?= =?Windows-1252?Q?GfWkytCHdaqmIyNz1CwUWZYQRRN2cfBYjZCRjn7DN8Zqd0hnM1cTzTON?= =?Windows-1252?Q?4+ZJtyu5TYzGgMduZSFRQWNTukFWm/MWt3j44n9ih6WhpM43JBMYuKSR?= =?Windows-1252?Q?mRahJTIcK7o5rEgPjnMsFr4qq8dvxsjgBEBmMooFCNoc8dgczqznkXMP?= =?Windows-1252?Q?ETyTqTIvE3Fyoo0qCJB7WiO0p5KUpToWopVV9TYFG9vez3vfhgVENj1F?= =?Windows-1252?Q?thGur4c62l/wq+hYldqgefJ0n/7z5ZtA4dympYUC92uZ1SG8LqdaJCpu?= =?Windows-1252?Q?wvAbMHCwuAnAP2SQ0DZCDGipzOw8kgwFmDUxWbUjdT7C0JllI2urtP9o?= =?Windows-1252?Q?72w2/EyhjwqIUZxN2NvWZ/kpNbFMZUxZ4m6BwtWAfqgnJnMHW6jwI2Hg?= =?Windows-1252?Q?CgQWv88zKE7I2e6pJmiYCz+viLMOgp82F008UakCBpY2dIKkzgOQWXAc?= =?Windows-1252?Q?XZPnXXwKsIVL58AJIsUsQmUMbaXiHH8codGm79nRXH88cDa4ntOqEldz?= =?Windows-1252?Q?ebEioH2thdKyIENwl9TXdKufFp/hYq40RNnN9KIHJuhBiwbCCXgEk2gR?= =?Windows-1252?Q?KE6uw7zWPtkPMafSbroPsEYke791kE0aQ1h887D7waMWGFr+mLav54ab?= =?Windows-1252?Q?EA6q0vo/Ar/zrfNhwzsB0Y/MxzjWjjp7yiYBEJKjZ0x0ncgALfwpZIoe?= =?Windows-1252?Q?i9MHSUK9r1lmTUCkFurFJOl29D6MnSPoeZghuD8pVk8vOOvXV5IHOT82?= =?Windows-1252?Q?Cy5OZ+WVavO7tIf43sSRELgTccpnmpO2px3DqlyyGzKk4prH2mwq/OnI?= =?Windows-1252?Q?KDD3nltg04A69qQ6GiNIAxh/2AjVRJ/tPjtswlZj7Q+rX/hFefuYDT/j?= =?Windows-1252?Q?/8IDx6dFRqqjmyLSj8ReF7g5/z58NJv6IqjcEg/wjj9tdzXP1x/Z/31J?= =?Windows-1252?Q?ubYgHYO2lzIOQyUVuvr+ZCSBHoEVxK9nB+OyWC6ATbGsnY5T1uKb+JSh?= =?Windows-1252?Q?7VazsPYdapI8Iw/C+l528uVTV0/aa9Ci+YYJxOJuxiJb05Bp3GiPMqLs?= =?Windows-1252?Q?tLJj7BzNVh17igmWVkaoiRI5Z0nrhdSaaQnaTLtBmAgTsgNchFchYbbn?= =?Windows-1252?Q?DXpKRGSYEl+sagNsNLBVsYMtgMESzKK8qZVJe1//m6m/j7BVHutHl6kh?= =?Windows-1252?Q?12QSdQqali1vER38qj0AOKX7tDD1X3lJdl5Z/rSAclXJbF0i35lUowrt?= =?Windows-1252?Q?nJlkU0/K7CEwSbbSJfn5h3ezYi0Ot5m78MNw7kTHPphp37XYk2peke+n?= =?Windows-1252?Q?d/UgcLyndjYjdz96cZ4h3hRSM4tAzXm+DtyzTIn5Kjj+6ahXmBiW/p3v?= =?Windows-1252?Q?qax/ydno6OXSor+8xJJs08FQyv7EQrCtJn/3NkeBqDhslK5XZTUad78a?= =?Windows-1252?Q?Ky/3yR8NBCUXaUR5RMc2WZJ+qs+LoQIodtDAH747/nSGZeYR2HE1IojU?= =?Windows-1252?Q?g9oIB6Dg1jlpk9ETQoP85aJ8?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CWXP265MB5009.GBRP265.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(8096899003)(7053199007)(38070700021);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?Windows-1252?Q?SN5EjS2+6rLIdc/1okgzuTCHjL3gcMt45qrJ7ED6PBUkp+PAVX4GC0wr?= =?Windows-1252?Q?RuBpA4ZmARQ2ZTHgFb0KevsYA23ly0Uh7na2XXOi6DWEZ1OmACH1r/3r?= =?Windows-1252?Q?SPo49uqCGTvkUP+fCSkOp0vUQHaQ2waXWQKZRVy0PvSGAfy4D5t6Js82?= =?Windows-1252?Q?/BtlkZQMuf36UzgSRpA3oERSKltQ6twotTK5Tzj69ID6o5dXmgcax9Ao?= =?Windows-1252?Q?GcDPZPldrSi6YLFcvfPg5zCbNxS/+NUWt1CAZEBGVxqm1xh9+1QrOCWz?= =?Windows-1252?Q?FFFx+cUFpckmYUdC2R6EHiDUy0fcgErEcW6PbBIl+u4qwd8iRc9m5DZ3?= =?Windows-1252?Q?A9BPoH/cYRzMgDrt0AQvyThZ8pSMhodF/QOyfdeIGQ4gbq61a1aVkSdU?= =?Windows-1252?Q?m1nugQ1bvCXbDW4RcvKhzWiP4wCRNxs8u+vA/QoTGIK9qzd6TpPVCoYK?= =?Windows-1252?Q?UNH1yl4VvMvrEAWlYCDYPVebx8i2k1fZpcB39sWjzCUtG8wkbJ7xIyzg?= =?Windows-1252?Q?PulqUV6Bz1mrEoVjfin2zGCwavb+0987KVOakeJzmLVx8reUJBKVKEjE?= =?Windows-1252?Q?JMN4gMn+YIHU2+mywYEIYHgz7TgfoLowjqqOLMkbZuomeBQg9AXWkkLA?= =?Windows-1252?Q?KotwslmeiGkUdcBPxgNGiIqFzK3YV21+uL9YrCvXex+zYIrbEy+tWti2?= =?Windows-1252?Q?0Oc193nVshx4nIaMJw7fRZYS9pb5NRHkIVUvsHxBueGRg0BJZeAWizBI?= =?Windows-1252?Q?Xmd/UKnvWicZJU7iVsDo7g1u+kQocQStMtx28W0V9GQ1tu6b82K4QSmU?= =?Windows-1252?Q?eTIgJxsE8bCwGrNttamdk1CVExSG4yoIPt/QsCic0etGmQPLHCrctkSn?= =?Windows-1252?Q?EEvWumE2BHPaYVZbRx+7r0DVi3pXhTVe5xEu5+r17irIz7qeF1kQEl9E?= =?Windows-1252?Q?9ZYNSozl5hun+qtCuBLO7ex9SyPdu9vdwR4QfgRtwvlLNYimzo8lRSuE?= =?Windows-1252?Q?zlfyDOmkm0wIrwvNe7dJLjaT6e1P9cs6Y/bi/CjhLgpesg2/gLn/DFJ2?= =?Windows-1252?Q?nF8Kdpd1qMF4PLqrdL5SJDXwaXto5Ta3YSSL4PwdhW051UubtPvAz1ng?= =?Windows-1252?Q?X/n42GF6GII0xr9qW8i9kZXszO1rILn2LYzo9hmJ6wqyvuSU0fiA3DkS?= =?Windows-1252?Q?GQHcbgKoiGLE3/wGaArllrvPX3g73fCxjS8Rw1ay1zd26eoieW3IxPY9?= =?Windows-1252?Q?bXH2xDQYxKeIOUIblsT0m3GoWRctZN0fCkdbHJOEhzLbrqgJH2zMchii?= =?Windows-1252?Q?rKD+m3sC37/9sF9911yvUpimc3Kq4/FwcyLJgxNKzzvdWPtxL+x19mOi?= =?Windows-1252?Q?cDXJNX/LNCnx/sZy/O29m19xL9cb+Ze0TXCru2goGw8ltL2Sqkg8ceOl?= =?Windows-1252?Q?SgXp0o1bvW3g9tx2mPv6gUpDFANxmL1zpYaC0B91V/NBVur6oW7mdgpr?= =?Windows-1252?Q?eJHnpV6ZyZTIIjwypY0ZTe4yFraC23PoZPC8J93K0xd/BuzIdyyv0a9Q?= =?Windows-1252?Q?wRv89dNNqBGw0zstKBdS4y8zbZm17mshJJ2dzo1QxPQ1lKtxsOu0VWWj?= =?Windows-1252?Q?eV/NKq740DquAZxCxFr9+eW0Z1yTXQ7GmqI4+gA0IkNuqTL7iO6RdCP1?= =?Windows-1252?Q?YjGsL0QgfXdWnh7iEdMxNyLypoaCf/m2jCq5iiqZ1ipWN40ig89UUQ?= =?Windows-1252?Q?=3D=3D?= Content-Type: multipart/alternative; boundary="_000_CWXP265MB5009813E2DAA4D48F8C4A9F4F7F5ACWXP265MB5009GBRP_" MIME-Version: 1.0 X-OriginatorOrg: automutatio.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CWXP265MB5009.GBRP265.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 47651f12-65f9-4483-c883-08de1026b2f0 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Oct 2025 22:19:12.9543 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 2f6d3b93-672f-4220-814a-a5deedb8a240 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: /y9mC/IVa3Mtm8WeKsbnE7jAvJE0ZuBgwDDVtyyWjeDU/my8f5hVgjy7RctIgdjuhRM5fLBnWLn4a0B4DJQXJLEwAbqrpEXorPICyFWZitE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CWLP265MB1922 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --_000_CWXP265MB5009813E2DAA4D48F8C4A9F4F7F5ACWXP265MB5009GBRP_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable 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 Sent: October 20, 2025 14:51 To: Paul Austin ; pgsql-general@lists.postgres= ql.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 > *Sent:* October 20, 2025 2:46 PM > *To:* pgsql-general@lists.postgresql.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=92t 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.klaver@aklaver.com --_000_CWXP265MB5009813E2DAA4D48F8C4A9F4F7F5ACWXP265MB5009GBRP_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable
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.klaver@aklaver.com>
Sent: October 20, 2025 14:51
To: Paul Austin <paul.austin@automutatio.com>; pgsql-gene= ral@lists.postgresql.org <pgsql-general@lists.postgresql.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.austin@automutatio.com>
> *Sent:* October 20, 2025 2:46 PM
> *To:* pgsql-general@lists.postgresql.org
> *Subject:* Extend CREATE POLICY to add IF EXISTS
>
> Many (but not all) DDL statements use the pattern IF EXISTS or IF NOT<= br> > EXISTS. This is really useful if you want to create a re-start-able da= ta
> 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=92t 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.klaver@aklaver.com
--_000_CWXP265MB5009813E2DAA4D48F8C4A9F4F7F5ACWXP265MB5009GBRP_--