Re: proposal - assign result of query to psql variable

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal - assign result of query to psql variable
Date: 2012-07-26 05:37:40
Message-ID: CAFj8pRAjcoXRBNMUFPJ5apjaMD14=yAsiYuLenArpX0tZhnkOA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2012/7/26 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
>> \eset variable [, variable [..]] query -- it raise exception when
>> more than one row is returned or when no row is returned
>
> Better would be a variant on \g, that is you type in the query and
> then tell it where to put the result. We have learned the hard way
> that putting SQL commands into the arguments of backslash commands
> is a horrid idea. Maybe
>
> select x,y,... from ...
> \gset var1 var2 ...

it could be

Pavel

>
> regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2012-07-26 06:19:55 Re: proposal - assign result of query to psql variable
Previous Message Tom Lane 2012-07-26 05:36:17 Re: proposal - assign result of query to psql variable