Skip site navigation (1) Skip section navigation (2)

pgsql: Improve pl/pgsql to support composite-type expressions inRETURN

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Improve pl/pgsql to support composite-type expressions inRETURN
Date: 2012-12-07 04:10:08
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-committers
Improve pl/pgsql to support composite-type expressions in RETURN.

For some reason lost in the mists of prehistory, RETURN was only coded to
allow a simple reference to a composite variable when the function's return
type is composite.  Allow an expression instead, while preserving the
efficiency of the original code path in the case where the expression is
indeed just a composite variable's name.  Likewise for RETURN NEXT.

As is true in various other places, the supplied expression must yield
exactly the number and data types of the required columns.  There was some
discussion of relaxing that for pl/pgsql, but no consensus yet, so this
patch doesn't address that.

Asif Rehman, reviewed by Pavel Stehule



Modified Files
doc/src/sgml/plpgsql.sgml             |   24 +++-
src/pl/plpgsql/src/pl_exec.c          |  275 ++++++++++++++++++++++-----------
src/pl/plpgsql/src/pl_gram.y          |   82 +++++------
src/pl/plpgsql/src/pl_scanner.c       |   20 +++-
src/pl/plpgsql/src/plpgsql.h          |    1 +
src/test/regress/expected/plpgsql.out |  132 ++++++++++++++++
src/test/regress/sql/plpgsql.sql      |  112 +++++++++++++
7 files changed, 508 insertions(+), 138 deletions(-)

pgsql-committers by date

Next:From: Simon RiggsDate: 2012-12-07 13:00:36
Subject: pgsql: Clarify that COPY FREEZE is not a hard rule.
Previous:From: Alvaro HerreraDate: 2012-12-06 21:35:38
Subject: Re: [COMMITTERS] pgsql: Background worker processes

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group