Add SysCacheGetAttrNotNull for guaranteed not-null attrs
authorDaniel Gustafsson <dgustafsson@postgresql.org>
Sat, 25 Mar 2023 21:49:33 +0000 (22:49 +0100)
committerDaniel Gustafsson <dgustafsson@postgresql.org>
Sat, 25 Mar 2023 21:49:33 +0000 (22:49 +0100)
commitd435f15fff3cf3cf5d6cfcfd63e21acc0f737829
tree9be0836e44c3b6809bf2f6910e9fd4a45ef1f217
parente33967b13bbc6e4e1c1b5e9ecd1c45148cffcc53
Add SysCacheGetAttrNotNull for guaranteed not-null attrs

When extracting an attr from a cached tuple in the syscache with
SysCacheGetAttr the isnull parameter must be checked in case the
attr cannot be NULL.  For cases when this is known beforehand, a
wrapper is introduced which perform the errorhandling internally
on behalf of the caller, invoking an elog in case of a NULL attr.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/AD76405E-DB45-46B6-941F-17B1EB3A9076@yesql.se
38 files changed:
src/backend/access/brin/brin_inclusion.c
src/backend/access/brin/brin_minmax.c
src/backend/access/brin/brin_minmax_multi.c
src/backend/access/index/indexam.c
src/backend/catalog/aclchk.c
src/backend/catalog/index.c
src/backend/catalog/objectaddress.c
src/backend/catalog/pg_constraint.c
src/backend/catalog/pg_proc.c
src/backend/catalog/pg_subscription.c
src/backend/commands/collationcmds.c
src/backend/commands/dbcommands.c
src/backend/commands/indexcmds.c
src/backend/commands/matview.c
src/backend/commands/subscriptioncmds.c
src/backend/commands/tablecmds.c
src/backend/commands/typecmds.c
src/backend/executor/execReplication.c
src/backend/executor/functions.c
src/backend/optimizer/util/clauses.c
src/backend/parser/parse_func.c
src/backend/parser/parse_utilcmd.c
src/backend/partitioning/partbounds.c
src/backend/statistics/extended_stats.c
src/backend/utils/adt/amutils.c
src/backend/utils/adt/pg_locale.c
src/backend/utils/adt/ruleutils.c
src/backend/utils/cache/lsyscache.c
src/backend/utils/cache/partcache.c
src/backend/utils/cache/syscache.c
src/backend/utils/fmgr/fmgr.c
src/backend/utils/fmgr/funcapi.c
src/backend/utils/init/postinit.c
src/include/utils/syscache.h
src/pl/plperl/plperl.c
src/pl/plpgsql/src/pl_comp.c
src/pl/plpython/plpy_procedure.c
src/pl/tcl/pltcl.c