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

From Josh Berkus
Subject Re: PATCH: make plpgsql IN args mutable (v1) [REVIEW]
Date
Msg-id 4AB12326.5080109@agliodbs.com
Whole thread Raw
In response to Re: PATCH: make plpgsql IN args mutable (v1) [REVIEW]  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: PATCH: make plpgsql IN args mutable (v1) [REVIEW]
Re: PATCH: make plpgsql IN args mutable (v1) [REVIEW]
List pgsql-hackers
> IIRC the original complaint was from someone trying to migrate code
> from T/SQL or some other not-quite-PLSQL language.  Like you, I'm on
> the fence about whether to accept this patch, but it does have some
> in-migration rationale.

As someone who writes a lot of plpgsql, I'm in favor of the patch.

1. Compatibility with PL/SQL, especially in the extra features
direction, has never been a tremendous priority for us before;

2. We don't particularly care if native plpgsql procedures can be
back-ported to PLSQL, and if we did there are much greater compatibility
issues than this one;

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$
DECLAREz INT := x;
BEGINz := x % y;RETURN z;
END; $f$

Becomes this:

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

-- 
Josh Berkus
PostgreSQL Experts Inc.
www.pgexperts.com


pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: Linux LSB init script
Next
From: Jeff Davis
Date:
Subject: Re: WIP: generalized index constraints