Re: BUG #5448: psql \set does not terminate if variable is referenced recursively - Mailing list pgsql-bugs

From Robert Haas
Subject Re: BUG #5448: psql \set does not terminate if variable is referenced recursively
Date
Msg-id AANLkTimGbawPQAGrsVOkCNi2XDM8fsuUm1f8KJy45lnv@mail.gmail.com
Whole thread Raw
In response to Re: BUG #5448: psql \set does not terminate if variable is referenced recursively  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Wed, May 5, 2010 at 1:50 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> The problem is there's no real support inside psql for "throwing an
> error" --- we have to unwind all the state manually. =A0In particular,
> what this problem requires is backing out the stack of flex buffers
> representing pending variable expansions. =A0So I think we need to add
> an explicit recursion test and suppress further expansion of the
> variable when we see it, but there's no very simple way to just abandon
> the current command altogether.

I notIced this when working on Pavel's patch to make :'foo' and :"foo"
do interpolation with literal/identifier quoting, and thought that it
would benefit from some refactoring, but didn't want to bother with it
at the time.  It's seems like kind of a pain for the amount of benefit
we'd likely to get out of it, but I think we'd probably be happier in
the long run.

http://en.wikipedia.org/wiki/Frog_boiling

--=20
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: "SET search_path" clause ignored during function creation
Next
From: Takahiro Itagaki
Date:
Subject: Re: [HACKERS] "SET search_path" clause ignored during function creation