On Sep 16, 2009, at 13:40 , Josh Berkus wrote:

3. This patch eliminates a common plpgsql beginner error and saves all
of us heavy plpgsql users some typing, especially when the use of a
mutable variable means that we can eliminate the DECLARE section
entirely, as in:

This:

CREATE PROCEDURE mod ( x int, y int )
RETURNS int LANGUAGE plpgsql
AS $f$
DECLARE
        z INT := x;
BEGIN
        z := x % y;
        RETURN z;
END; $f$

This is also currently valid:

CREATE FUNCTION mod (x int, y int)
RETURNS int LANGUAGE plpgsql
AS $f$
DECLARE
 z INT := x % y;
BEGIN
  RETURN z;
END; $f$

As is this:

CREATE FUNCTION mod (x int, y int)
RETURNS int LANGUAGE plpgsql
AS $f$
BEGIN
  RETURN (x % y);
END; $f$

Michael Glaesemann
grzm seespotcode net


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

Reply via email to