Re: psql - -dry-run option

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: psql - -dry-run option
Дата
Msg-id 15791.1450383201@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: psql - -dry-run option  (Christopher Browne <cbbrowne@gmail.com>)
Ответы Re: psql - -dry-run option  ("Shulgin, Oleksandr" <oleksandr.shulgin@zalando.de>)
Список 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 по дате отправления:

Предыдущее
От: Christopher Browne
Дата:
Сообщение: Re: psql - -dry-run option
Следующее
От: Joe Conway
Дата:
Сообщение: Re: psql - -dry-run option