Re: Function declaration - Mailing list pgsql-sql

From Sean Davis
Subject Re: Function declaration
Date
Msg-id 00a201c5447d$f7f50d40$5179f345@WATSON
Whole thread Raw
In response to Function declaration  ("A. Kulikov" <a.kulikov@gmail.com>)
List pgsql-sql
Alex,

What happens if you declare your function as:

function(text,text)

or whatever your datatypes for each argument are supposed to be and then, 
within your function, test whether the arguments are NULL?  I haven't tried 
it, so I can't say for sure, but it seems like you should be able to pass a 
SQL NULL as an argument.

Sean

----- Original Message ----- 
From: "A. Kulikov" <a.kulikov@gmail.com>
To: "Sean Davis" <sdavis2@mail.nih.gov>
Sent: Monday, April 18, 2005 8:44 PM
Subject: Re: [SQL] Function declaration


Unfortunately that is not what I am looking for =( Although the task I
have in mind can be accomplished using overloading. Is there no
equivalent in plpgsql for

function(foo,bar=null)...

??

regards,

alex

2005/4/19, Sean Davis <sdavis2@mail.nih.gov>:
> Alex,
>
> I think what you are looking for is called function overloading.  See the
> documenation here:
>
> http://www.postgresql.org/docs/8.0/interactive/xfunc-overload.html
>
> Sean
>
> ----- Original Message -----
> From: "A. Kulikov" <a.kulikov@gmail.com>
> To: <pgsql-sql@postgresql.org>
> Sent: Monday, April 18, 2005 8:28 PM
> Subject: [SQL] Function declaration
>
> Is there a possiblity to declare functions with optional parameters
> i.e. in case some parameters are not passed to the function, then some
> kind of default value is assigned to the function?
>
>


-- 
The mind is essential -- http://essentialmind.com/




pgsql-sql by date:

Previous
From: "A. Kulikov"
Date:
Subject: Function declaration
Next
From: shaun
Date:
Subject: CREATE USER in side a TRIGGER FUNCTION