On Fri, Nov 5, 2010 at 8:44 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> That spells "large maintenance burden" to me, even if any one command
> would be relatively simple to fix. And we haven't even reached the
> question of whether pg_dump could use these things usefully; I suspect
> that the bottom-line issue there might be something else entirely.
Well, why not? I was in the middle of writing it. But I'm open to
other approaches, the real motivating issue could be stated simply as:
"pg_dump --clean should produce output that can be run on empty, full
or partially-full databases in a transaction without a non-zero error
code"
ALTER IF EXISTS just struck me as one such mechanism that is familiar
looking, at least.
Also take note that I suffered from some syntactic dyslexia above, IF
EXISTS doesn't appear to ever occur after the identifier, so the
example would be:
ALTER TABLE IF EXISTS foo DROP CONSTRAINT IF EXISTS bar;
To me this reads fine, although I agree that it could be annoying to
main this optional-ness on a large series of commands.
One might be able to imagine a special backend function to do this
missing-identifier guarding, that may shorten the whole thing up a
bit...any suggestions, in that line of thinking or others?
fdr