Implement IF NOT EXISTS for CREATE PUBLICATION AND CREATE SUBSCRIPTION

Started by vignesh Cabout 3 years ago2 messageshackers
Jump to latest
#1vignesh C
vignesh21@gmail.com

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

Attachments:

v1-0001-Implement-IF-NOT-EXISTS-for-CREATE-PUBLICATION-AN.patchtext/x-patch; charset=US-ASCII; name=v1-0001-Implement-IF-NOT-EXISTS-for-CREATE-PUBLICATION-AN.patchDownload+109-11
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: vignesh C (#1)
Re: Implement IF NOT EXISTS for CREATE PUBLICATION AND CREATE SUBSCRIPTION

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