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

Поиск
Список
Период
Сортировка
От Gevik Babakhani
Тема Re: Proposal TODO Item: SQL-language reference parameters by name
Дата
Msg-id 011f01c81c05$5ed264c0$0a01a8c0@gevmus
обсуждение исходный текст
Ответ на Proposal TODO Item: SQL-language reference parameters by name  ("Gevik Babakhani" <pgdev@xs4all.nl>)
Список pgsql-hackers
Thank you Tom.

After running a create function statement (language sql), the final check 
for a column is done in
parse_expr.c:transformColumnRef in case 1. Would this be the correct place 
to implement
functionality for a final match?

Regards,
Gevik.


----- Original Message ----- 
From: "Tom Lane" <tgl@sss.pgh.pa.us>
To: "Gevik Babakhani" <pgdev@xs4all.nl>
Cc: <pgsql-hackers@postgresql.org>
Sent: Wednesday, October 31, 2007 4:36 AM
Subject: Re: [HACKERS] Proposal TODO Item: SQL-language reference parameters 
by name


> "Gevik Babakhani" <pgdev@xs4all.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
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: You can help support the PostgreSQL project by donating at
>
>                http://www.postgresql.org/about/donate
> 



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: A small rant about coding style for backend functions
Следующее
От: Tom Lane
Дата:
Сообщение: Re: psql show dbsize?