Commit 3153b1a5 authored by Robert Haas's avatar Robert Haas

Eliminate a few more user-visible "cache lookup failed" errors.

Michael Paquier
parent 5676da2d
...@@ -2238,11 +2238,11 @@ pg_get_function_arguments(PG_FUNCTION_ARGS) ...@@ -2238,11 +2238,11 @@ pg_get_function_arguments(PG_FUNCTION_ARGS)
StringInfoData buf; StringInfoData buf;
HeapTuple proctup; HeapTuple proctup;
initStringInfo(&buf);
proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid)); proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(proctup)) if (!HeapTupleIsValid(proctup))
elog(ERROR, "cache lookup failed for function %u", funcid); PG_RETURN_NULL();
initStringInfo(&buf);
(void) print_function_arguments(&buf, proctup, false, true); (void) print_function_arguments(&buf, proctup, false, true);
...@@ -2264,11 +2264,11 @@ pg_get_function_identity_arguments(PG_FUNCTION_ARGS) ...@@ -2264,11 +2264,11 @@ pg_get_function_identity_arguments(PG_FUNCTION_ARGS)
StringInfoData buf; StringInfoData buf;
HeapTuple proctup; HeapTuple proctup;
initStringInfo(&buf);
proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid)); proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(proctup)) if (!HeapTupleIsValid(proctup))
elog(ERROR, "cache lookup failed for function %u", funcid); PG_RETURN_NULL();
initStringInfo(&buf);
(void) print_function_arguments(&buf, proctup, false, false); (void) print_function_arguments(&buf, proctup, false, false);
...@@ -2289,11 +2289,11 @@ pg_get_function_result(PG_FUNCTION_ARGS) ...@@ -2289,11 +2289,11 @@ pg_get_function_result(PG_FUNCTION_ARGS)
StringInfoData buf; StringInfoData buf;
HeapTuple proctup; HeapTuple proctup;
initStringInfo(&buf);
proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid)); proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(proctup)) if (!HeapTupleIsValid(proctup))
elog(ERROR, "cache lookup failed for function %u", funcid); PG_RETURN_NULL();
initStringInfo(&buf);
print_function_rettype(&buf, proctup); print_function_rettype(&buf, proctup);
...@@ -2547,7 +2547,7 @@ pg_get_function_arg_default(PG_FUNCTION_ARGS) ...@@ -2547,7 +2547,7 @@ pg_get_function_arg_default(PG_FUNCTION_ARGS)
proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid)); proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(proctup)) if (!HeapTupleIsValid(proctup))
elog(ERROR, "cache lookup failed for function %u", funcid); PG_RETURN_NULL();
numargs = get_func_arg_info(proctup, &argtypes, &argnames, &argmodes); numargs = get_func_arg_info(proctup, &argtypes, &argnames, &argmodes);
if (nth_arg < 1 || nth_arg > numargs || !is_input_argument(nth_arg - 1, argmodes)) if (nth_arg < 1 || nth_arg > numargs || !is_input_argument(nth_arg - 1, argmodes))
......
...@@ -3094,3 +3094,33 @@ SELECT pg_get_viewdef(0); ...@@ -3094,3 +3094,33 @@ SELECT pg_get_viewdef(0);
(1 row) (1 row)
SELECT pg_get_function_arguments(0);
pg_get_function_arguments
---------------------------
(1 row)
SELECT pg_get_function_identity_arguments(0);
pg_get_function_identity_arguments
------------------------------------
(1 row)
SELECT pg_get_function_result(0);
pg_get_function_result
------------------------
(1 row)
SELECT pg_get_function_arg_default(0, 0);
pg_get_function_arg_default
-----------------------------
(1 row)
SELECT pg_get_function_arg_default('pg_class'::regclass, 0);
pg_get_function_arg_default
-----------------------------
(1 row)
...@@ -1152,3 +1152,8 @@ SELECT pg_get_indexdef(0); ...@@ -1152,3 +1152,8 @@ SELECT pg_get_indexdef(0);
SELECT pg_get_ruledef(0); SELECT pg_get_ruledef(0);
SELECT pg_get_triggerdef(0); SELECT pg_get_triggerdef(0);
SELECT pg_get_viewdef(0); SELECT pg_get_viewdef(0);
SELECT pg_get_function_arguments(0);
SELECT pg_get_function_identity_arguments(0);
SELECT pg_get_function_result(0);
SELECT pg_get_function_arg_default(0, 0);
SELECT pg_get_function_arg_default('pg_class'::regclass, 0);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment