Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8d4b311

Browse files
committed
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
1 parent b65431c commit 8d4b311

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/utils/adt/ruleutils.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1759,9 +1759,9 @@ pg_get_statisticsobjdef_expressions(PG_FUNCTION_ARGS)
17591759
statexttup = SearchSysCache1(STATEXTOID, ObjectIdGetDatum(statextid));
17601760

17611761
if (!HeapTupleIsValid(statexttup))
1762-
elog(ERROR, "cache lookup failed for statistics object %u", statextid);
1762+
PG_RETURN_NULL();
17631763

1764-
/* has the statistics expressions? */
1764+
/* Does the stats object have expressions? */
17651765
has_exprs = !heap_attisnull(statexttup, Anum_pg_statistic_ext_stxexprs, NULL);
17661766

17671767
/* no expressions? we're done */

0 commit comments

Comments
 (0)