Re: Alternative to psql -c ?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: James Le Cuirot <chewi(at)aura-online(dot)co(dot)uk>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Alternative to psql -c ?
Date: 2014-06-26 22:00:56
Message-ID: 76139.1403820056@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

James Le Cuirot <chewi(at)aura-online(dot)co(dot)uk> writes:
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> PG is not capable of executing queries that are not in transactions,
>> so yes, PQsendQuery will create a single-statement transaction if you
>> haven't sent BEGIN. However, there's a huge difference for the
>> purposes we're discussing here: PQsendQuery does not allow more than
>> one SQL command in the string. So most of this discussion is
>> irrelevant when you're going through that API.

> Heh, are you sure? From the docs...

> "Using PQsendQuery and PQgetResult solves one of PQexec's problems: If a
> command string contains multiple SQL commands, the results of those
> commands can be obtained individually."

Oh, sorry, I was confusing that with the extended-query-mode API
(PQexecParams).

Yeah, PQsendQuery is like PQexec for this purpose --- the backend does
not actually know the difference.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tim Uckun 2014-06-26 22:31:58 Re: Fast data, slow data
Previous Message James Le Cuirot 2014-06-26 21:51:41 Re: Alternative to psql -c ?