unexpected psql "feature"

Поиск
Список
Период
Сортировка
От Fabien COELHO
Тема unexpected psql "feature"
Дата
Msg-id alpine.DEB.2.20.1607132218580.26777@sto
обсуждение исходный текст
Ответы Re: unexpected psql "feature"  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: unexpected psql "feature"  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Christopher Browne
Дата:
Сообщение: Re: A Modest Upgrade Proposal
Следующее
От: Petr Jelinek
Дата:
Сообщение: Re: A Modest Upgrade Proposal