Re: proposal - assign result of query to psql variable

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Phil Sorber <phil(at)omniti(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Shigeru HANADA <shigeru(dot)hanada(at)gmail(dot)com>, 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-10-25 14:38:15
Message-ID: 27593.1351175895@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> I gave this a look. I think it needs to be revised by somebody with a
> better understanding of scanner (flex) than me, but I didn't like the
> changes in psqlscan.l at all; the new <xvl> pattern is too unlike the
> rest of the surrounding patterns, and furthermore it has been placed
> within the block that says it mirrors the backend scanner, when it
> obviously has no equivalent there.

> I assume there's a better way to do this. Hints would be appreciated.

Personally I saw no reason for this patch to touch psqlscan.l in the
first place. Commands such as \set just scan variable names with
psql_scan_slash_option(OT_NORMAL); why shouldn't this act the same?

Moreover, the proposed lexer rules are flat out *wrong*, in that they
insist on the target variable names being {identifier}s, a restriction
not imposed by \set.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2012-10-25 15:03:56 Re: proposal - assign result of query to psql variable
Previous Message Alvaro Herrera 2012-10-25 14:24:14 Re: proposal - assign result of query to psql variable