Re: Function declaration

From: "Sean Davis" <sdavis2(at)mail(dot)nih(dot)gov>
To: "A(dot) Kulikov" <a(dot)kulikov(at)gmail(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Function declaration
Date: 2005-04-19 01:20:26
Message-ID: 00a201c5447d$f7f50d40$5179f345@WATSON
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)kulikov(at)gmail(dot)com>
To: "Sean Davis" <sdavis2(at)mail(dot)nih(dot)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(at)mail(dot)nih(dot)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(dot)kulikov(at)gmail(dot)com>
> To: <pgsql-sql(at)postgresql(dot)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/

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Rod Taylor 2005-04-19 02:00:09 Re: Getting the output of a function used in a where clause
Previous Message A. Kulikov 2005-04-19 00:28:30 Function declaration