From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Fix plpgsql to enforce domain checks when returning a NULL domai |
Date: | 2018-02-15 21:25:28 |
Message-ID: | E1emR20-0005Wb-0R@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix plpgsql to enforce domain checks when returning a NULL domain value.
If a plpgsql function is declared to return a domain type, and the domain's
constraints forbid a null value, it was nonetheless possible to return
NULL, because we didn't bother to check the constraints for a null result.
I'd noticed this while fooling with domains-over-composite, but had not
gotten around to fixing it immediately.
Add a regression test script exercising this and various other domain
cases, largely borrowed from the plpython_types test.
Although this is clearly a bug fix, I'm not sure whether anyone would
thank us for changing the behavior in stable branches, so I'm inclined
not to back-patch.
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/51db0d18fbf58b0c2e5ebc2b5b2c48daf45c8d93
Modified Files
--------------
src/pl/plpgsql/src/Makefile | 2 +-
src/pl/plpgsql/src/expected/plpgsql_domain.out | 397 +++++++++++++++++++++++++
src/pl/plpgsql/src/pl_comp.c | 4 +
src/pl/plpgsql/src/pl_exec.c | 16 +
src/pl/plpgsql/src/plpgsql.h | 1 +
src/pl/plpgsql/src/sql/plpgsql_domain.sql | 279 +++++++++++++++++
6 files changed, 698 insertions(+), 1 deletion(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2018-02-16 01:55:57 | Re: pgsql: Use new overflow aware integer operations. |
Previous Message | Tom Lane | 2018-02-15 18:57:39 | pgsql: Doc: fix minor bug in CREATE TABLE example. |