allow select from void function in void sql function

Lists: pgsql-patches
From: "Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: allow select from void function in void sql function
Date: 2006-03-16 17:32:12
Message-ID: BAY20-F3EE19CFC8F2ACED5D35A6F9E70@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Hello

this small patch allow use sql for creating wrappers others void functions.
Currently void SQL function have to be empty.

create or replace function foo(int) returns void as ' ','' language c ..;
create or replace function foo() returns void as $$ select foo(10);
$$language sql;

regards
Pavel

_________________________________________________________________
Emotikony a pozadi programu MSN Messenger ozivi vasi konverzaci.
http://messenger.msn.cz/

Attachment Content-Type Size
void_wrap.dif application/octet-stream 4.0 KB

From: "Jaime Casanova" <systemguards(at)gmail(dot)com>
To: "Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: allow select from void function in void sql function
Date: 2006-03-17 03:56:43
Message-ID: c2d9e70e0603161956h9c15614u9044ca1990ef8cfe@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On 3/16/06, Pavel Stehule <pavel(dot)stehule(at)hotmail(dot)com> wrote:
> Hello
>
> this small patch allow use sql for creating wrappers others void functions.
> Currently void SQL function have to be empty.
>
> create or replace function foo(int) returns void as ' ','' language c ..;
> create or replace function foo() returns void as $$ select foo(10);
> $$language sql;
>
> regards
> Pavel
>

i'm not clear on what the use case of this can be... of course, my
opinion is not very important :)

--
regards,
Jaime Casanova

"What they (MySQL) lose in usability, they gain back in benchmarks, and that's
all that matters: getting the wrong answer really fast."
Randal L. Schwartz


From: David Fetter <david(at)fetter(dot)org>
To: Jaime Casanova <systemguards(at)gmail(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)hotmail(dot)com>, pgsql-patches(at)postgresql(dot)org
Subject: Re: allow select from void function in void sql function
Date: 2006-03-17 05:31:39
Message-ID: 20060317053139.GA3711@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On Thu, Mar 16, 2006 at 10:56:43PM -0500, Jaime Casanova wrote:
> On 3/16/06, Pavel Stehule <pavel(dot)stehule(at)hotmail(dot)com> wrote:
> > Hello
> >
> > this small patch allow use sql for creating wrappers others void
> > functions. Currently void SQL function have to be empty.
> >
> > create or replace function foo(int) returns void as ' ',''
> > language c ..; create or replace function foo() returns void as $$
> > select foo(10); $$language sql;
> >
>
> i'm not clear on what the use case of this can be... of course, my
> opinion is not very important :)

I can think of a case. Let's imagine you want to do (roughly) the
equivalent of CALL, which we don't have yet. This would let you have
what amounts to a stored procedure, i.e. something that takes an
action but doesn't return rows. :)

Cheers,
D
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
phone: +1 415 235 3778 AIM: dfetter666
Skype: davidfetter

Remember to vote!


From: "Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com>
To: systemguards(at)gmail(dot)com
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: allow select from void function in void sql function
Date: 2006-03-17 05:37:44
Message-ID: BAY20-F22B2F51C2EB065BBEAA809F9E40@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


> > Hello
> >
> > this small patch allow use sql for creating wrappers others void
>functions.
> > Currently void SQL function have to be empty.
> >
> > create or replace function foo(int) returns void as ' ','' language c
>..;
> > create or replace function foo() returns void as $$ select foo(10);
> > $$language sql;
> >
> > regards
> > Pavel
> >
>
>i'm not clear on what the use case of this can be... of course, my
>opinion is not very important :)
>

First. I write bigger C library - implementation of some dbms_packages and
plvision packages. I don't expect using plpgsql. I have a lot of void
functions. Usually set_...unset_ with and I need sql language for createing
wrappers for default values. That's all.
Second. The logic in PostgreSQL is wrong now. Is too hard and too simple. I
can get VOID value via SELECT void function too.

Pavel

_________________________________________________________________
Chcete sdilet sve obrazky a hudbu s prateli? http://messenger.msn.cz/