From 4c3aa85a4e1c2d4356e5f81a769fd3711e330763 Mon Sep 17 00:00:00 2001 From: Dan Sosedoff Date: Mon, 19 Dec 2022 13:22:41 -0600 Subject: [PATCH] Exclude pg_temp tables from other queries --- pkg/statements/sql/objects.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/statements/sql/objects.sql b/pkg/statements/sql/objects.sql index d970710..415624e 100644 --- a/pkg/statements/sql/objects.sql +++ b/pkg/statements/sql/objects.sql @@ -20,7 +20,7 @@ WITH all_objects AS ( pg_catalog.pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind IN ('r','v','m','S','s','') - AND n.nspname !~ '^pg_toast' + AND n.nspname !~ '^pg_(toast|temp)' AND n.nspname NOT IN ('information_schema', 'pg_catalog') AND has_schema_privilege(n.nspname, 'USAGE') @@ -38,7 +38,7 @@ WITH all_objects AS ( JOIN pg_catalog.pg_proc p ON p.pronamespace = n.oid WHERE - n.nspname !~ '^pg_toast' + n.nspname !~ '^pg_(toast|temp)' AND n.nspname NOT IN ('information_schema', 'pg_catalog') ) SELECT * FROM all_objects