dbTalk Databases Forums  

[SQL] defaults in a function

mailing.database.pgsql-sql mailing.database.pgsql-sql


Discuss [SQL] defaults in a function in the mailing.database.pgsql-sql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
John Fabiani
 
Posts: n/a

Default [SQL] defaults in a function - 06-06-2012 , 10:08 AM






Hi,
In python when I create a method/function is set a default value for a
passed value if one is not provided.

def foo(self, event = None):

In the above function if the second value is not passed a value of None
is used as the default.

Is this possible with plpgsql???

Johnf

--
Sent via pgsql-sql mailing list (pgsql-sql (AT) postgresql (DOT) org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Reply With Quote
  #2  
Old   
David Johnston
 
Posts: n/a

Default Re: [SQL] defaults in a function - 06-06-2012 , 10:27 AM






On Jun 6, 2012, at 11:08, John Fabiani <johnf (AT) jfcomputer (DOT) com> wrote:

Quote:
Hi,
In python when I create a method/function is set a default value for a passed value if one is not provided.

def foo(self, event = None):

In the above function if the second value is not passed a value of None is used as the default.

Is this possible with plpgsql???

Johnf

http://www.postgresql.org/docs/9.0/i...efunction.html

.... param_n type DEFAULT value
OR
.... param_n type = value

It is SQL DDL syntax and not specific to the language the function is written in.

David J.



--
Sent via pgsql-sql mailing list (pgsql-sql (AT) postgresql (DOT) org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.