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

From: David Fetter <david(at)fetter(dot)org>
To: Gevik Babakhani <pgdev(at)xs4all(dot)nl>
Cc: pgsql-patches(at)postgresql(dot)org, 'Tom Lane' <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: V0.2 patch for TODO Item: SQL-language reference parameters by name.
Date: 2007-11-03 15:56:40
Message-ID: 20071103155640.GJ3913@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

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

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Pavel Stehule 2007-11-03 16:09:06 Re: V0.2 patch for TODO Item: SQL-language reference parameters by name.
Previous Message Gevik Babakhani 2007-11-03 11:36:45 V0.2 patch for TODO Item: SQL-language reference parameters by name.