unexpected psql "feature" - Mailing list pgsql-hackers

From Fabien COELHO
Subject unexpected psql "feature"
Date
Msg-id alpine.DEB.2.20.1607132218580.26777@sto
Whole thread Raw
Responses Re: unexpected psql "feature"
Re: unexpected psql "feature"
List pgsql-hackers
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.

My guess is that psql uses PQexec which just returns the last result. 
Using PQsendQuery/PQgetResult would result in a much better behavior.
 fabien=# CREATE TABLE foo(id TEXT); CREATE TABLE fabien=# INSERT INTO foo VALUES('calvin') \; fabien-# INSERT INTO foo
VALUES('hobbes'); INSERT 0 1 fabien=# SELECT * FROM foo;    id --------  calvin  hobbes (2 rows)
 

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

Any opinion?

-- 
Fabien.



pgsql-hackers by date:

Previous
From: Christopher Browne
Date:
Subject: Re: A Modest Upgrade Proposal
Next
From: Petr Jelinek
Date:
Subject: Re: A Modest Upgrade Proposal