From: Daniel CAUNE <d.caune@free.fr>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: Function with default value?
Date: Sun, 29 Jan 2006 22:40:46 -0500
Message-ID: <0ITV00K44LNX4C10@VL-MO-MR002.ip.videotron.ca> (raw)
In-Reply-To: <1793.1138549677@sss.pgh.pa.us>
> -----Message d'origine-----
> De : Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Envoyé : dimanche 29 janvier 2006 10:48
> À : Daniel CAUNE
> Cc : pgsql-sql@postgresql.org
> Objet : Re: [SQL] Function with default value?
>
> Daniel CAUNE <d.caune@free.fr> writes:
> > Is it possible to define a function with some default values?
> > CREATE OR REPLACE FUNCTION foo(i IN int, j IN int DEFAULT := 1)
>
> No. But you can fake many versions of this with a family of functions:
>
> CREATE OR REPLACE FUNCTION foo(i IN int, j IN int) ...
>
> CREATE OR REPLACE FUNCTION foo(i IN int) ... return foo(i, 1) ...
>
> Remember that PG lets you "overload" a function name by using the same
> name with different parameter lists.
>
> regards, tom lane
Yes, thanks Tom, for the second time.
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: d.caune@free.fr, tgl@sss.pgh.pa.us
Subject: Re: Function with default value?
In-Reply-To: <0ITV00K44LNX4C10@VL-MO-MR002.ip.videotron.ca>
* 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