pgsql: Fix plpgsql to enforce domain checks when returning a NULLdomai

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix plpgsql to enforce domain checks when returning a NULLdomai
Дата
Msg-id E1emR20-0005Wb-0R@gemulon.postgresql.org
обсуждение исходный текст
Список 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(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Doc: fix minor bug in CREATE TABLE example.
Следующее
От: Andres Freund
Дата:
Сообщение: Re: pgsql: Use new overflow aware integer operations.