Re: V0.2 patch for TODO Item: SQL-language reference parameters by name. - Mailing list pgsql-patches

On Sat, Nov 03, 2007 at 12:36:45PM +0100, Gevik Babakhani wrote:
> Hello All,
>
> This patch implements a (generic) callback functionality in the parser.
> The mechanism can be used to send callback messages from within the parser
> to external functions.
>
> I would like to know your opinion about the following:
>
> In previous discussion Tom referred to:
>
> >One point here is that it would be good to be able to qualify the argument
> > names with the function name, for example
> >    create function myfunc(x int) ...
> >        select ... from t where t.x = myfunc.x
>
> The above is possible but I think qualifying the argument names with the
> function name
> can be cumbersome when one has to provide the function name multiple times.
> For example: (where clause)
>
> create or replace function sp_item_get_by_type_or_category(p_type
> integer,p_category integer)
>     returns setof item_view as
> $$
>     select ..... from item_view i
>         inner join tblcategory c on i.catid = c.catid
>         inner join tbltype t on i.typeid = t.typeid
>     where
>         c.catid = sp_item_get_by_type_or_category.p_category or
>         t.typeid = sp_item_get_by_type_or_categor.p_type;
> $$
> language sql;
>
> Perhaps we could use the word "this"  instead of the entire function name
>
> For example:
> ....
>     where
>         c.catid = this.p_category or
>         t.typeid = this.p_type;
> ....
>
>
> Any thoughts?

I think a prefix of ':' would be good, as it's already a standard,
kinda.  Anybody who names a database object :foo deserves whatever
happens to them :P

Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

pgsql-patches by date:

Previous
From: "Gevik Babakhani"
Date:
Subject: V0.2 patch for TODO Item: SQL-language reference parameters by name.
Next
From: "Pavel Stehule"
Date:
Subject: Re: V0.2 patch for TODO Item: SQL-language reference parameters by name.