Re: [GENERAL] Alternative to psql -c ?

2014-06-27 Thread James Le Cuirot
On Thu, 26 Jun 2014 15:00:56 -0700 Tom Lane wrote: > James Le Cuirot writes: > > Tom Lane wrote: > >> PG is not capable of executing queries that are not in > >> transactions, so yes, PQsendQuery will create a single-statement > >> transaction if you hav

Re: [GENERAL] Alternative to psql -c ?

2014-06-26 Thread James Le Cuirot
On Thu, 26 Jun 2014 11:02:09 -0700 Tom Lane wrote: > James Le Cuirot writes: > > 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 do

Re: [GENERAL] Alternative to psql -c ?

2014-06-26 Thread James Le Cuirot
On Thu, 26 Jun 2014 07:23:02 -0500 Merlin Moncure wrote: > On Thu, Jun 26, 2014 at 4:30 AM, James Le Cuirot > wrote: > > On Wed, 25 Jun 2014 13:21:44 -0500 > > Merlin Moncure wrote: > > > >> > The cookbook currently uses PQexec so multiple SQL commands

Re: [GENERAL] Alternative to psql -c ?

2014-06-26 Thread James Le Cuirot
On Wed, 25 Jun 2014 17:30:15 +0200 hubert depesz lubaczewski wrote: > On Wed, Jun 25, 2014 at 5:18 PM, James Le Cuirot > wrote: > > > > Also - I have no idea what "peer authentication" has to do with Pg > > > gem - care to elaborate? The gem is for client

Re: [GENERAL] Alternative to psql -c ?

2014-06-26 Thread James Le Cuirot
On Wed, 25 Jun 2014 10:34:57 -0500 Jerry Sievers wrote: > > The cookbook currently uses PQexec so multiple SQL commands are > > wrapped in a transaction unless an explicit transaction > > instruction appears. I don't want to change this behaviour but > > the only way to get exactly the same effec

Re: [GENERAL] Alternative to psql -c ?

2014-06-26 Thread James Le Cuirot
On Wed, 25 Jun 2014 13:21:44 -0500 Merlin Moncure wrote: > > The cookbook currently uses PQexec so multiple SQL commands are > > wrapped in a transaction unless an explicit transaction > > instruction appears. I don't want to change this behaviour but > > the only way to get exactly the same effe

Re: [GENERAL] Alternative to psql -c ?

2014-06-26 Thread James Le Cuirot
On Wed, 25 Jun 2014 09:04:44 -0700 Tom Lane wrote: > James Le Cuirot writes: > > hubert depesz lubaczewski wrote: > >> Perhaps you can explain what is the functionality you want to > >> achieve, as I, for one, don't understand. Do you want transactions? > &

Re: [GENERAL] Alternative to psql -c ?

2014-06-25 Thread James Le Cuirot
On Wed, 25 Jun 2014 16:42:53 +0200 hubert depesz lubaczewski wrote: > On Wed, Jun 25, 2014 at 4:37 PM, James Le Cuirot > wrote: > > > On Wed, 25 Jun 2014 10:24:53 -0400 > > Andrew Sullivan wrote: > > > > > On Wed, Jun 25, 2014 at 03:16:19PM +0100, James L

Re: [GENERAL] Alternative to psql -c ?

2014-06-25 Thread James Le Cuirot
On Wed, 25 Jun 2014 10:24:53 -0400 Andrew Sullivan wrote: > On Wed, Jun 25, 2014 at 03:16:19PM +0100, James Le Cuirot wrote: > > Same problem as stdin, the transactional behaviour is different. > > There is the --single-transaction option but as the man page says... > >

Re: [GENERAL] Alternative to psql -c ?

2014-06-25 Thread James Le Cuirot
On Wed, 25 Jun 2014 10:09:18 -0400 Andrew Sullivan wrote: > On Wed, Jun 25, 2014 at 02:43:25PM +0100, James Le Cuirot wrote: > > > The cookbook currently uses PQexec so multiple SQL commands are > > wrapped in a transaction unless an explicit transaction > > instruction

[GENERAL] Alternative to psql -c ?

2014-06-25 Thread James Le Cuirot
Hello, I've been using the Chef database cookbook and found it frustrating because it doesn't allow you to use peer authentication. The client process generally runs as root and connects to PostgreSQL using the Ruby pg gem. I have patched it to shell out to psql instead. This has the added benefi