Fix error code for null FOR PORTION OF target

When the target expression of FOR PORTION OF (...) evaluated to NULL,
ExecInitModifyTable raised an error without an errcode, so clients got
the internal error code XX000 for a user-reachable condition.
Oversight in commit 8e72d914c52.

To fix, report ERRCODE_NULL_VALUE_NOT_ALLOWED, and reword the message
to "FOR PORTION OF target must not be null", matching similar executor
messages such as "frame starting offset must not be null".

Bug: #19630
Reported-by: Zheng Wang <[email protected]>
Reported-by: Yanjie Zhao
Reported-by: Yiyang Liu
Author: Zsolt Parragi <[email protected]>
Discussion: 
https://www.postgresql.org/message-id/flat/19630-9f10ca28426295fa%40postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c16a1b4f2ce8e88ec40d1465c01e327ab8721524

Modified Files
--------------
src/backend/executor/nodeModifyTable.c       | 5 +++--
src/test/regress/expected/for_portion_of.out | 8 ++++----
2 files changed, 7 insertions(+), 6 deletions(-)

Reply via email to