Re: proposal - assign result of query to psql variable

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Shigeru Hanada <shigeru(dot)hanada(at)gmail(dot)com>
Cc: Phil Sorber <phil(at)omniti(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Erik Rijkers <er(at)xs4all(dot)nl>, David Fetter <david(at)fetter(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal - assign result of query to psql variable
Date: 2012-12-17 17:52:19
Message-ID: CAFj8pRDrhDVj=NpBF_gKKcwd-k3sFE6gUjL-ts_hLuimywZJjw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2012/12/17 Shigeru Hanada <shigeru(dot)hanada(at)gmail(dot)com>:
> On Sun, Oct 28, 2012 at 7:16 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>> Hello
>>
>> here is updated patch
>>
>> main change - it doesn't touch psql lexer - like Tom proposed
>> other points respect Phil's notices
>
> I reviewed v12 patch. It provides gset command which works
> consistently with other psql commands, such as \g and \set, and
> implementation seems reasonable, and follows other reviewer's comments
> properly. I think we can mark it as "ready for committer", once you
> have fixed some minor issues below.
>
> * Skipping leading blank in inner while loop of command.c seems
> unnecessary, because (IIUC) psql's scanner skips blanks. Is there any
> case that scanner returns token with leading/trailing blank?

removed

> * ISTM that VARLIST_INITIAL can be removed. AFAIS it's same state as
> VARLIST_EXPECTED_COMMA_OR_IDENT.

removed

> * I found some cosmetic flaw and typo. Please see attached patch for details.

it is ok, merged

> * How about pulling up codes for PGRES_TUPLES_OK case in
> StoreQueryResult to new static function, say StoreQueryTuple? It
> would make StoreQueryResult more similar to PrintQueryResult's style,
> and IMO it makes the code more readable.

good idea
done

Attached updated patch

Regards

Pavel

>
> Regards,
> --
> Shigeru HANADA

Attachment Content-Type Size
gset_13.diff application/octet-stream 18.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2012-12-17 17:56:04 Re: XLByte* usage
Previous Message Tom Lane 2012-12-17 17:47:41 Re: XLByte* usage