Re: pgbench - allow to store select results into variables

Поиск
Список
Период
Сортировка
От Fabien COELHO
Тема Re: pgbench - allow to store select results into variables
Дата
Msg-id alpine.DEB.2.20.1607132140100.26777@sto
обсуждение исходный текст
Ответ на Re: pgbench - allow to store select results into variables  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: pgbench - allow to store select results into variables  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hello Robert,

> I agree: I like \into.

Great!

> But:
>
>> SELECT 1, 2 \; SELECT 3;
>>  \into one two three
>
> I think that's pretty weird.

I agree that it is weird, but I do not think that it is bad.

Sending a batch of requests is a feature of libpq which is accessible 
through pgbench by using "\;", although the fact is not documented. It 
makes sense for a client to send independent queries together so as to 
reduce latency.

From pgbench perspective, I would find it pretty weird as well that one 
can send several queries together but could only read the answer from... 
say the first one, and the others would be lost.

From an implementation perspective doing it is straightforward, and 
rejecting it would require some more logic.

An obvious nicer feature would be to allow intermixing \into & \; but ISTM 
that it would require to rethink deeply pgbench lexing/parsing which has 
just been merged with psql by Tom and others...

If I had not pointed out the fact that it works, maybe no one would have 
noticed... so a compromise could be not to advertise the fact that it 
works (as the \; feature is not advertised anyway), but letting the 
implementation do it because it is simple and may be useful, and rephrase 
the documentation so that it is just about the previous select and not 
previous select*S*?

-- 
Fabien.



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pgbench - allow to store select results into variables
Следующее
От: Tom Lane
Дата:
Сообщение: Re: sslmode=require fallback