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

Re: Proposal TODO Item: SQL-language reference parameters by name

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Gevik Babakhani" <pgdev(at)xs4all(dot)nl>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Proposal TODO Item: SQL-language reference parameters by name
Date: 2007-10-31 03:36:44
Message-ID: 8094.1193801804@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
"Gevik Babakhani" <pgdev(at)xs4all(dot)nl> writes:
>> I think the most likely implementation would involve adding hooks
>> in the parser at places where "unknown column" errors are about to
>> be thrown, so that a function language could check for a match to
>> one of its variable names only after the query-exposed names are
>> checked.

> Would this be the right path to follow?

> Assuming we are allowed to include parameter names into ParseState, we can
> match the "non existing" colnames against the list of parameter
> names when transformColumnRef (or someware safe in that path).

You are assuming that the function language isn't interested in taking
some extra action when a reference to a parameter is recognized.  This
is demonstrably false for plpgsql, for one --- it wants to build a list
of just which variables it will have to pass into each SQL command.
A hook function can take care of that, a passive data structure can't.

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2007-10-31 03:41:03
Subject: Re: UTF-8 for SGML docs?
Previous:From: Tatsuo IshiiDate: 2007-10-31 01:46:18
Subject: UTF-8 for SGML docs?

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