Re: unexpected psql "feature"

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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: pgbench - allow to store select results into variables
Следующее
От: Tom Lane
Дата:
Сообщение: Re: unexpected psql "feature"