postgres.git / summary / log / commit / refs

commit    0332993c4e14f13b211f41535f77aadb305fd354
Author:   Peter Eisentraut <peter_e@gmx.net>
Date:     Fri Jun 09 23:49:18 2017 +0000

    doc: Improve types in example
    
    Reported-by: Nikolaus Thiel <klt@fsfe.org>


doc/src/sgml/xfunc.sgml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml index 10e3c0cef9f..05f4312bf3e 100644 --- a/doc/src/sgml/xfunc.sgml +++ b/doc/src/sgml/xfunc.sgml @@ -302,7 +302,7 @@ SELECT add_em(1, 2) AS answer; bank account: <programlisting> -CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS integer AS $$ +CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS numeric AS $$ UPDATE bank SET balance = balance - debit WHERE accountno = tf1.accountno; @@ -333,7 +333,7 @@ SELECT tf1(17, 100.0); is: <programlisting> -CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS integer AS $$ +CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS numeric AS $$ UPDATE bank SET balance = balance - debit WHERE accountno = tf1.accountno; @@ -345,7 +345,7 @@ $$ LANGUAGE SQL; The same thing could be done in one command using <literal>RETURNING</>: <programlisting> -CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS integer AS $$ +CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS numeric AS $$ UPDATE bank SET balance = balance - debit WHERE accountno = tf1.accountno [parent: 0933fcee9851]