From: | James Le Cuirot <chewi(at)aura-online(dot)co(dot)uk> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Alternative to psql -c ? |
Date: | 2014-06-26 09:22:04 |
Message-ID: | 20140626102204.36ced4dd@red.yakaraplc.local |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, 25 Jun 2014 09:04:44 -0700
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> James Le Cuirot <chewi(at)aura-online(dot)co(dot)uk> writes:
> > hubert depesz lubaczewski <depesz(at)gmail(dot)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.
> 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.
The mention of "legacy behaviour" and "unexpected results" in the
psql man page hadn't gone unnoticed but I didn't think I would be able
to convince the Chef guys to change their approach based on that. I
think I stand a much better chance now that you of all people have said
it though so thanks. :)
This got me wondering what Rails uses. I dug into ActiveRecord and
found that apart from the odd call to PQexec with hardcoded single
statements, it uses PQsendQuery. The libpq docs state a few of the
differences but don't mention whether PQsendQuery automatically creates
a transaction like PQexec does. Please could you clarify this?
Regards,
James
From | Date | Subject | |
---|---|---|---|
Next Message | Tim Uckun | 2014-06-26 09:29:47 | Fast data, slow data |
Previous Message | Rémi Cura | 2014-06-26 09:14:27 | Re: python modul pre-import to avoid importing each time |