pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Function declaration
2+ messages / 2 participants
[nested] [flat]

* Function declaration
@ 2005-04-19 00:28 A. Kulikov <a.kulikov@gmail.com>
  2005-04-19 01:20 ` Re: Function declaration Sean Davis <sdavis2@mail.nih.gov>
  0 siblings, 1 reply; 2+ messages in thread

From: A. Kulikov @ 2005-04-19 00:28 UTC (permalink / raw)
  To: pgsql-sql

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?

regards,

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Function declaration
  2005-04-19 00:28 Function declaration A. Kulikov <a.kulikov@gmail.com>
@ 2005-04-19 01:20 ` Sean Davis <sdavis2@mail.nih.gov>
  0 siblings, 0 replies; 2+ messages in thread

From: Sean Davis @ 2005-04-19 01:20 UTC (permalink / raw)
  To: A. Kulikov <a.kulikov@gmail.com>; +Cc: 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/





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-04-19 01:20 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-04-19 00:28 Function declaration A. Kulikov <a.kulikov@gmail.com>
2005-04-19 01:20 ` Sean Davis <sdavis2@mail.nih.gov>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox