Re: Alternative to psql -c ?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Alternative to psql -c ?
Дата
Msg-id 75889.1403712284@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Alternative to psql -c ?  (James Le Cuirot <chewi@aura-online.co.uk>)
Ответы Re: Alternative to psql -c ?
Список pgsql-general
James Le Cuirot <chewi@aura-online.co.uk> writes:
> hubert depesz lubaczewski <depesz@gmail.com> wrote:
>> Perhaps you can explain what is the functionality you want to
>> achieve, as I, for one, don't understand. Do you want transactions?
>> Or not?

> I want an implicit transaction around the whole script if no explicit
> transactions are present in the script. This is what psql's -c option
> does and this is also what the pg gem does because both use PQexec.

Well, psql -c (and also multiple commands in PQexec) have more odd
behaviors than that.  Notably, any error causes abandonment of the *whole*
string, even if it's got begin/end commands in it.

Most people think that psql -c's behavior is a legacy thing that we ought
to change someday; if backwards compatibility weren't such a big deal
around here, we might've done it already.  You can find multiple bugs in
the pgsql-bugs archives that amount to complaints that psql -c ought to
work more like reading from stdin or a file.  I don't think it's a good
idea for you to try to arrange things so that untold amounts of code is
depending on that behavior never changing.

In short, I think it would be good to push back on the way Chef is doing
things now, not perpetuate a dependency on a legacy behavior.

            regards, tom lane


В списке pgsql-general по дате отправления:

Предыдущее
От: Jerry Sievers
Дата:
Сообщение: Re: Alternative to psql -c ?
Следующее
От: Karthik Iyer
Дата:
Сообщение: DATA corruption after promoting slave to master