aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/ruleutils.c
diff options
context:
space:
mode:
authorTomas Vondra <tomas.vondra@postgresql.org>2021-05-07 13:56:32 +0200
committerTomas Vondra <tomas.vondra@postgresql.org>2021-05-07 14:34:16 +0200
commit8d4b311d2494ca592e30aed03b29854d864eb846 (patch)
tree3eebe7a08c62ef092122b0a08f27a0f6007870ed /src/backend/utils/adt/ruleutils.c
parentb65431ca5e12a475ba7cf68afb63edb070c2ce08 (diff)
downloadpostgresql-8d4b311d2494ca592e30aed03b29854d864eb846.tar.gz
postgresql-8d4b311d2494ca592e30aed03b29854d864eb846.zip
Make pg_get_statisticsobjdef_expressions return NULL
The usual behavior for functions in ruleutils.c is to return NULL when the object does not exist. pg_get_statisticsobjdef_expressions raised an error instead, so correct that. Reported-by: Justin Pryzby Discussion: https://postgr.es/m/20210505210947.GA27406%40telsasoft.com
Diffstat (limited to 'src/backend/utils/adt/ruleutils.c')
-rw-r--r--src/backend/utils/adt/ruleutils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 0a4fa93d016..881e8ec03d2 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -1759,9 +1759,9 @@ pg_get_statisticsobjdef_expressions(PG_FUNCTION_ARGS)
statexttup = SearchSysCache1(STATEXTOID, ObjectIdGetDatum(statextid));
if (!HeapTupleIsValid(statexttup))
- elog(ERROR, "cache lookup failed for statistics object %u", statextid);
+ PG_RETURN_NULL();
- /* has the statistics expressions? */
+ /* Does the stats object have expressions? */
has_exprs = !heap_attisnull(statexttup, Anum_pg_statistic_ext_stxexprs, NULL);
/* no expressions? we're done */