pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sean Davis <sdavis2@mail.nih.gov>
To: A. Kulikov <a.kulikov@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Function declaration
Date: Mon, 18 Apr 2005 21:20:26 -0400
Message-ID: <00a201c5447d$f7f50d40$5179f345@WATSON> (raw)
References: <fc63e1af050418172862f162ad@mail.gmail.com>
	<006101c54478$7b2fed70$5179f345@WATSON>
	<fc63e1af05041817443d01d825@mail.gmail.com>

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/





view thread (2+ messages)

Message-ID: <00a201c5447d$f7f50d40$5179f345@WATSON>
Permalink:  ../00a201c5447d$f7f50d40$5179f345@WATSON/
Also on:    postgresql.org/message-id/00a201c5447d$f7f50d40$5179f345@WATSON

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sdavis2@mail.nih.gov, a.kulikov@gmail.com
  Subject: Re: Function declaration
  In-Reply-To: <00a201c5447d$f7f50d40$5179f345@WATSON>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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