From: Justin Pryzby Date: Wed, 5 May 2021 04:29:00 -0500 Subject: [PATCH 1/3] Return NULL rather than elog(ERROR) for sql-callable function --- src/backend/utils/adt/ruleutils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 0a4fa93d01..881e8ec03d 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 */ -- 2.17.0 --aX6oBa4COn3eIhlv Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0002-Comment-typos-extended-stats-a4d75c86b-and-518442c7f.patch"