From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: PostgreSQL Developers <pgsql-hackers@postgresql.org>
Subject: Re: pgbench - allow to store select results into variables
Date: Sat, 9 Jul 2016 11:19:15 +0200 (CEST)
Message-ID: <alpine.DEB.2.20.1607091057300.3412@sto> (raw)
In-Reply-To: <CAFj8pRAgU0OzGM7Vqpf2KUR0KP2YNhtG54ji06W5StGmwyQKnA@mail.gmail.com>
References: <alpine.DEB.2.20.1607091005330.3412@sto>
<CAFj8pRAgU0OzGM7Vqpf2KUR0KP2YNhtG54ji06W5StGmwyQKnA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Hello Pavel,
> Why you are introducing \into and not \gset like psql does?
Good question.
The \into syntax I implemented is more generic, you can send a bunch of
queries together and extract the results, which makes sense from a client
perspective where reducing latency is important:
SELECT 1, 2 \; SELECT 3;
\into one two three
However "gset" only works on the last SELECT and if all columns have a
name. This feature probably makes sense interactively, but for a script it
seems more useful to allow batch processing and collect results
afterwards.
Also a more subjective argument: I do not like the gset automagic naming
feature. I got more inspired by PL/pgSQL and ECPG which both have an
"into" syntax with explicit variable names that let nothing to guessing. I
like things to be simple and explicit, hence the proposed into.
--
Fabien.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: coelho@cri.ensmp.fr, pavel.stehule@gmail.com
Subject: Re: pgbench - allow to store select results into variables
In-Reply-To: <alpine.DEB.2.20.1607091057300.3412@sto>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox