Skip to content

Commit 3153b1a

Browse files
committed
Eliminate a few more user-visible "cache lookup failed" errors.
Michael Paquier
1 parent 5676da2 commit 3153b1a

File tree

3 files changed

+45
-10
lines changed

3 files changed

+45
-10
lines changed

src/backend/utils/adt/ruleutils.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2238,11 +2238,11 @@ pg_get_function_arguments(PG_FUNCTION_ARGS)
22382238
StringInfoData buf;
22392239
HeapTuple proctup;
22402240

2241-
initStringInfo(&buf);
2242-
22432241
proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
22442242
if (!HeapTupleIsValid(proctup))
2245-
elog(ERROR, "cache lookup failed for function %u", funcid);
2243+
PG_RETURN_NULL();
2244+
2245+
initStringInfo(&buf);
22462246

22472247
(void) print_function_arguments(&buf, proctup, false, true);
22482248

@@ -2264,11 +2264,11 @@ pg_get_function_identity_arguments(PG_FUNCTION_ARGS)
22642264
StringInfoData buf;
22652265
HeapTuple proctup;
22662266

2267-
initStringInfo(&buf);
2268-
22692267
proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
22702268
if (!HeapTupleIsValid(proctup))
2271-
elog(ERROR, "cache lookup failed for function %u", funcid);
2269+
PG_RETURN_NULL();
2270+
2271+
initStringInfo(&buf);
22722272

22732273
(void) print_function_arguments(&buf, proctup, false, false);
22742274

@@ -2289,11 +2289,11 @@ pg_get_function_result(PG_FUNCTION_ARGS)
22892289
StringInfoData buf;
22902290
HeapTuple proctup;
22912291

2292-
initStringInfo(&buf);
2293-
22942292
proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
22952293
if (!HeapTupleIsValid(proctup))
2296-
elog(ERROR, "cache lookup failed for function %u", funcid);
2294+
PG_RETURN_NULL();
2295+
2296+
initStringInfo(&buf);
22972297

22982298
print_function_rettype(&buf, proctup);
22992299

@@ -2547,7 +2547,7 @@ pg_get_function_arg_default(PG_FUNCTION_ARGS)
25472547

25482548
proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
25492549
if (!HeapTupleIsValid(proctup))
2550-
elog(ERROR, "cache lookup failed for function %u", funcid);
2550+
PG_RETURN_NULL();
25512551

25522552
numargs = get_func_arg_info(proctup, &argtypes, &argnames, &argmodes);
25532553
if (nth_arg < 1 || nth_arg > numargs || !is_input_argument(nth_arg - 1, argmodes))

src/test/regress/expected/rules.out

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3094,3 +3094,33 @@ SELECT pg_get_viewdef(0);
30943094

30953095
(1 row)
30963096

3097+
SELECT pg_get_function_arguments(0);
3098+
pg_get_function_arguments
3099+
---------------------------
3100+
3101+
(1 row)
3102+
3103+
SELECT pg_get_function_identity_arguments(0);
3104+
pg_get_function_identity_arguments
3105+
------------------------------------
3106+
3107+
(1 row)
3108+
3109+
SELECT pg_get_function_result(0);
3110+
pg_get_function_result
3111+
------------------------
3112+
3113+
(1 row)
3114+
3115+
SELECT pg_get_function_arg_default(0, 0);
3116+
pg_get_function_arg_default
3117+
-----------------------------
3118+
3119+
(1 row)
3120+
3121+
SELECT pg_get_function_arg_default('pg_class'::regclass, 0);
3122+
pg_get_function_arg_default
3123+
-----------------------------
3124+
3125+
(1 row)
3126+

src/test/regress/sql/rules.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,3 +1152,8 @@ SELECT pg_get_indexdef(0);
11521152
SELECT pg_get_ruledef(0);
11531153
SELECT pg_get_triggerdef(0);
11541154
SELECT pg_get_viewdef(0);
1155+
SELECT pg_get_function_arguments(0);
1156+
SELECT pg_get_function_identity_arguments(0);
1157+
SELECT pg_get_function_result(0);
1158+
SELECT pg_get_function_arg_default(0, 0);
1159+
SELECT pg_get_function_arg_default('pg_class'::regclass, 0);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy