Skip site navigation (1) Skip section navigation (2)

Re: Function with default value?

From: Daniel CAUNE <d(dot)caune(at)free(dot)fr>
To: 'Tom Lane' <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Function with default value?
Date: 2006-01-30 03:40:46
Message-ID: 0ITV00K44LNX4C10@VL-MO-MR002.ip.videotron.ca (view raw or flat)
Thread:
Lists: pgsql-sql
> -----Message d'origine-----
> De : Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
> Envoyé : dimanche 29 janvier 2006 10:48
> À : Daniel CAUNE
> Cc : pgsql-sql(at)postgresql(dot)org
> Objet : Re: [SQL] Function with default value?
> 
> Daniel CAUNE <d(dot)caune(at)free(dot)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.


In response to

pgsql-sql by date

Next:From: Michael FuhrDate: 2006-01-30 04:24:24
Subject: Re: variable scooping
Previous:From: ody quravihartoDate: 2006-01-30 02:01:37
Subject: variable scooping

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group