From 5672bfcf608d437151d07135427c9dbb8edf270d Mon Sep 17 00:00:00 2001 From: Lea Laux Date: Mon, 8 Mar 2021 13:39:41 +0100 Subject: [PATCH] Kick temporary schemas out of tree by a regex --- pygadmin/models/treemodel.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pygadmin/models/treemodel.py b/pygadmin/models/treemodel.py index fc76e7b..1f90d53 100644 --- a/pygadmin/models/treemodel.py +++ b/pygadmin/models/treemodel.py @@ -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 - # 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 " "!= '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):