Re: Implement IF NOT EXISTS for CREATE PUBLICATION AND CREATE SUBSCRIPTION

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: vignesh C <vignesh21(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Implement IF NOT EXISTS for CREATE PUBLICATION AND CREATE SUBSCRIPTION
Date: 2023-03-12 17:27:55
Message-ID: 1461574.1678642075@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

vignesh C <vignesh21(at)gmail(dot)com> writes:
> Currently we don't support "IF NOT EXISTS" for Create publication and
> Create subscription, I felt it would be useful to add this "IF NOT
> EXISTS" which will create publication/subscription only if the object
> does not exist.
> Attached patch for handling the same.
> Thoughts?

I generally dislike IF NOT EXISTS options, because they are so
semantically squishy: when the command is over, you cannot make any
assumptions whatsoever about the properties of the object, beyond
the bare fact that it exists. I do not think we should implement
such options without a pretty compelling argument that there is a
use-case for them. "I felt it would be useful" doesn't meet the
bar IMO.

CREATE OR REPLACE doesn't have this semantic problem, but I'm not
sure whether it's a useful approach for these types of objects.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2023-03-12 17:30:00 Re: Improve WALRead() to suck data directly from WAL buffers when possible
Previous Message Alexander Korotkov 2023-03-12 16:05:47 Re: POC: Lock updated tuples in tuple_update() and tuple_delete()