Kick temporary schemas out of tree by a regex

This commit is contained in:
Lea Laux 2021-03-08 13:39:41 +01:00 committed by KDV Admin
parent 3af98454d8
commit 5672bfcf60

View File

@ -276,10 +276,11 @@ class DatabaseNode(AbstractBaseNode):
""" """
# Use a query to get all children, in this case, all the schema nodes except pg_toast, pg_toast_temp_1 and # Use a query to get all children, in this case, all the schema nodes except pg_toast, pg_toast_temp_1 and
# pg_temp_1 as unused schemas. # pg_temp_1 as unused schemas. Ignore also all pg_temp_ with three additional numbers at the end.
self.fetch_children(SchemaNode, "SELECT schema_name FROM information_schema.schemata WHERE schema_name " self.fetch_children(SchemaNode, "SELECT schema_name FROM information_schema.schemata WHERE schema_name "
"!= 'pg_toast' AND schema_name != 'pg_toast_temp_1' AND schema_name " "!= 'pg_toast' AND schema_name != 'pg_toast_temp_1' AND schema_name "
"!= 'pg_temp_1' ORDER BY schema_name ASC;") "!= 'pg_temp_1' AND schema_name NOT SIMILAR TO 'pg_temp_[0-9]{3}' "
"ORDER BY schema_name ASC;")
class SchemaNode(AbstractBaseNode): class SchemaNode(AbstractBaseNode):