Re: unexpected psql "feature"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: unexpected psql "feature"
Date: 2016-07-13 21:36:00
Message-ID: 2946.1468445760@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> writes:
> Hello devs,

> Although this is probably a "feature", it is a weird one:

> $ psql
> psql (9.6beta2)
> fabien=# SELECT 1 AS one \;
> fabien-# SELECT 2 AS two ;
> two
> -----
> 2
> (1 row)

> Where is my "1"?

> Although "\;" behavior is not documented, I would have expected both
> results to be shown one after the other, or having a an error, but not a
> quiet discard.

See the documentation for PQexec(): all but the last query result is
discarded.

> I would suggest that:
> - the \; psql feature should be documented somewhere
> - all results should be shown, not just the last one

> Any opinion?

I do not think changing this is appropriate. All you are likely to
accomplish is breaking code that does what its author wanted.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2016-07-13 21:44:17 Re: unexpected psql "feature"
Previous Message Fabien COELHO 2016-07-13 21:33:50 Re: unexpected psql "feature"