Skip site navigation (1) Skip section navigation (2)

Re: plpgsql and qualified variable names

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Affan Salman" <affan(at)enterprisedb(dot)com>, "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: plpgsql and qualified variable names
Date: 2007-07-16 02:23:36
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
I wrote:
> ... In at least those three cases, we know that it's not sensible to
> substitute a parameter.  If that's true in all the problem cases,
> which seems likely, then we could do something with Greg's idea
> of using the raw parse tree from the main SQL parser to guide
> decisions about where parameters may be substituted.

BTW, I looked into this a bit and found that it doesn't seem to be a
simple change.  Basically what we'd want to do is take out the current
behavior in which the plpgsql lexer knows anything about which
identifiers are plpgsql variables, and have the substitutions happen
later, after we've run the collected statement or expression through
the main grammar.  The problem is that doing so breaks the recognition
of plpgsql assignment statements, since the grammar currently keys off
the fact that the first token of the statement has been recognized to
match a variable name by the lexer.  I'm not sure what's the most
reasonable way to fix that, but at the moment it looks like we're
talking about a pretty thoroughgoing redesign of the plpgsql lexer
and parser.

Anyway it seems like this whole area is a research project for 8.4
or later, not something we should try to fix now.  But having said
that, there didn't seem to be any objection to the idea of changing
the outer block (where function parameters are declared) to be labeled
with the function name, instead of having no label as at present.
Does anyone think we should not do that for 8.3?

			regards, tom lane

In response to


pgsql-hackers by date

Next:From: Pavel StehuleDate: 2007-07-16 05:54:23
Subject: Re: plpgsql and qualified variable names
Previous:From: Andrew DunstanDate: 2007-07-16 02:21:10
Subject: Re: write_pipe_chunks patch messes up early error message output

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group