Re: psql - -dry-run option - Mailing list pgsql-hackers

From Tom Lane
Subject Re: psql - -dry-run option
Date
Msg-id 15791.1450383201@sss.pgh.pa.us
Whole thread Raw
In response to Re: psql - -dry-run option  (Christopher Browne <cbbrowne@gmail.com>)
Responses Re: psql - -dry-run option  ("Shulgin, Oleksandr" <oleksandr.shulgin@zalando.de>)
List pgsql-hackers
Christopher Browne <cbbrowne@gmail.com> writes:
> On 17 December 2015 at 14:16, Pavel Stehule <pavel.stehule@gmail.com> wrote:
>> or different idea - just enforce syntax check without execution.

> That seems pretty cool...  I'd find "syntax check without execution" to be
> pretty useful to test SQL (and especially DDL).

If it didn't execute the DDL at all, I doubt it would be that useful ---
you could not test any statements that depended on earlier statements.
Moreover, people might get surprised by error checks that they expect
to get reported by the "syntax check" but actually are not made until
runtime.  There's a lot of behavior there that's currently just
implementation detail but would become user-visible, depending on just
where the syntax check stops processing.

So what you want I think is something that *does* execute everything,
but within a single transaction that is guaranteed not to get committed.
A bulletproof version of that would likely need to be implemented on the
server side, not with some psql hack.

Whether we really need a feature like that isn't clear though; it's not
like it's hard to test things that way now.  Stick in a BEGIN with no
COMMIT, you're there.  The problem only comes in if you start expecting
the behavior to be bulletproof.  Maybe I'm being too pessimistic about
what people would believe a --dry-run switch to be good for ... but
I doubt it.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Christopher Browne
Date:
Subject: Re: psql - -dry-run option
Next
From: Joe Conway
Date:
Subject: Re: psql - -dry-run option