On Wed, 25 Jun 2014 09:04:44 -0700 Tom Lane <tgl@xxxxxxxxxxxxx> wrote: > James Le Cuirot <chewi@xxxxxxxxxxxxxxxxx> writes: > > hubert depesz lubaczewski <depesz@xxxxxxxxx> 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