Re: unexpected psql "feature"

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: unexpected psql "feature"
Date: 2016-07-13 21:33:50
Message-ID: alpine.DEB.2.20.1607132320170.26777@sto
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello David,

At least we aggree that having a documentation would be an improvement:-)

On the second point:

>> - all results should be shown, not just the last one
>
> disagree
>
> # select 1 ; select 2 ;

vs

> # select 1 \; select 2 ;
>
> Result in identical behavior seems undesirable.

In both cases there is the two same queries, so having the same results
does not strike me as "undesirable", on the contrary.

> At least now if you want to discard all intermediate work and just show
> the last statement you can do so without going to any great lengths. If
> you really want both results don't use "\;". This makes even more sense
> when the earlier statements are DML instead of SELECT.

Hmmm. I do not buy this "\; executes a statement but does not show the
results" as a sane and expected behavior.

I think that the underlying and only reason it behaves like this is that
at the protocol level one can send a batch of queries in one go, but for
the simple "PQexec" function just one result is returned, the last one was
chosen probably as a marker that they were all executed, and that is all.

So I see this as a low-level simplified API detail which has an unforeseen
user impact.

--
Fabien.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-07-13 21:36:00 Re: unexpected psql "feature"
Previous Message David G. Johnston 2016-07-13 21:31:16 Re: pgbench - allow to store select results into variables