From: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
---|---|
To: | PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | unexpected psql "feature" |
Date: | 2016-07-13 20:47:05 |
Message-ID: | alpine.DEB.2.20.1607132218580.26777@sto |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 last one
Any opinion?
--
Fabien.
From | Date | Subject | |
---|---|---|---|
Next Message | Petr Jelinek | 2016-07-13 20:48:14 | Re: A Modest Upgrade Proposal |
Previous Message | Christopher Browne | 2016-07-13 20:42:05 | Re: A Modest Upgrade Proposal |