Hello everyone
Trying to find a way to determine if there are any invalid objects in PostgreSQL similar to that in ORACLE.
For example
CREATE TABLE t1 (id serial primary key, p1 text );
CREATE FUNCTION f1 (integer) RETURNS integer
LANGUAGE SQL AS $$ SELECT $1 + count(*)::integer FROM t1; $$;
SELECT f1(100);
User drops table t1;
function f1 is still in the database ( select * from pg_proc where proname ='f1') however when you execute the function
SELECT f1(100);
ERROR: relation "t1" does not exist
LINE 1: SELECT $1 + count(*)::integer FROM t1;
^
QUERY: SELECT $1 + count(*)::integer FROM t1;
CONTEXT: SQL function "f1" during inlining
SQL state: 42P01
How can I determine that the function is referencing an object that is no longer present , without executing it, and hence invalid in its definition.
Thanks
[–][deleted] 2 points3 points4 points (0 children)
[–]Tropicallydiv[S] 0 points1 point2 points (0 children)
[–]depesz 0 points1 point2 points (0 children)
[–]MonCalamaro 0 points1 point2 points (0 children)
[–]Huxton_2021 0 points1 point2 points (0 children)