From: | Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Add strict_multi_assignment and too_many_rows plpgsql checks |
Date: | 2018-07-24 23:47:30 |
Message-ID: | E1fi71e-0003Ui-Dz@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
Add strict_multi_assignment and too_many_rows plpgsql checks
Until now shadowed_variables was the only plpgsql check supported by
plpgsql.extra_warnings and plpgsql.extra_errors. This patch introduces
two new checks - strict_multi_assignment and too_many_rows. Unlike
shadowed_variables, these new checks are enforced at run-time.
strict_multi_assignment checks that commands allowing multi-assignment
(for example SELECT INTO) have the same number of sources and targets.
too_many_rows checks that queries with an INTO clause return one row
exactly.
These checks are aimed at cases that are technically valid and allowed,
but are often a sign of a bug. Therefore those checks are expected to
be enabled primarily in development and testing environments.
Author: Pavel Stehule
Reviewed-by: Stephen Frost, Tomas Vondra
Discussion: https://www.postgresql.org/message-id/flat/CAFj8pRA2kKRDKpUNwLY0GeG1OqOp+tLS2yQA1V41gzuSz-hCng(at)mail(dot)gmail(dot)com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/167075be3ab1547e186096bb8e6e448cd8eea5af
Modified Files
--------------
doc/src/sgml/plpgsql.sgml | 115 +++++++++++++++++++++++++++-------
src/pl/plpgsql/src/pl_exec.c | 108 ++++++++++++++++++++++++++++---
src/pl/plpgsql/src/pl_handler.c | 4 ++
src/pl/plpgsql/src/plpgsql.h | 10 +--
src/test/regress/expected/plpgsql.out | 107 +++++++++++++++++++++++++++++++
src/test/regress/sql/plpgsql.sql | 89 ++++++++++++++++++++++++++
6 files changed, 400 insertions(+), 33 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2018-07-25 23:47:49 | pgsql: LLVMJIT: Check for 'noinline' attribute in recursively inlined f |
Previous Message | Thomas Munro | 2018-07-24 23:06:39 | pgsql: Pad semaphores to avoid false sharing. |
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Gierth | 2018-07-24 23:48:01 | Re: Early WIP/PoC for inlining CTEs |
Previous Message | Andres Freund | 2018-07-24 23:10:10 | Re: Early WIP/PoC for inlining CTEs |