pgspot icon indicating copy to clipboard operation
pgspot copied to clipboard

Make tracking of object creation and search_path optional

Open svenklemm opened this issue 2 years ago • 0 comments

Since we don't do control flow analysis our object creation tracking can mask potential problems and produce false negatives. The following snippet would not produce a warning about unsafe function creation even though it should since the first CREATE FUNCTION would never execute making the 2nd CREATE OR REPLACE unsafe.

DO $$
BEGIN
  IF false THEN
     CREATE FUNCTION f1() RETURNS int LANGUAGE SQL AS $w2$ SELECT 1; $w2$;
  END IF;
END; $$;
CREATE OR REPLACE FUNCTION f1() RETURNS int LANGUAGE SQL AS $$ SELECT 1; $$;

svenklemm avatar Apr 24 '22 11:04 svenklemm