Re: PATCH: make plpgsql IN args mutable (v1) [REVIEW] - Mailing list pgsql-hackers

From Michael Glaesemann
Subject Re: PATCH: make plpgsql IN args mutable (v1) [REVIEW]
Date
Msg-id 373468D7-CB78-4D51-AA82-5323D848FA71@seespotcode.net
Whole thread Raw
In response to Re: PATCH: make plpgsql IN args mutable (v1) [REVIEW]  (Josh Berkus <josh@agliodbs.com>)
Responses Re: PATCH: make plpgsql IN args mutable (v1) [REVIEW]
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Feedback on getting rid of VACUUM FULL
Next
From: Jeff Davis
Date:
Subject: Re: Feedback on getting rid of VACUUM FULL