Re: proposal - assign result of query to psql variable

Поиск
Список
Период
Сортировка
От David Fetter
Тема Re: proposal - assign result of query to psql variable
Дата
Msg-id 20120726063655.GB16582@fetter.org
обсуждение исходный текст
Ответ на Re: proposal - assign result of query to psql variable  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: proposal - assign result of query to psql variable  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
On Thu, Jul 26, 2012 at 08:31:13AM +0200, Pavel Stehule wrote:
> 2012/7/26 David Fetter <david@fetter.org>:
> > On Thu, Jul 26, 2012 at 01:36:17AM -0400, Tom Lane wrote:
> >> Pavel Stehule <pavel.stehule@gmail.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 ...
> >
> > How about
> >
> > \gset var1,,,var2,var3...
> >
> 
> I don't like this - you can use fake variable - and ignoring some
> variable has no big effect on client

Why assign to a variable you'll never use?

Cheers,
David.

P.S.  The bike shed should be puce with blaze orange pin-striping.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: proposal - assign result of query to psql variable
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: proposal - assign result of query to psql variable