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

Implement IF NOT EXISTS for CREATE PUBLICATION AND CREATE SUBSCRIPTION

From
vignesh C
Date:
Hi,

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?

Regards,
Vignesh

Attachment
vignesh C <vignesh21@gmail.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