SVN Commit by dpage: r4473 - trunk/pgadmin3/src/schema - Mailing list pgadmin-hackers

From svn@pgadmin.org
Subject SVN Commit by dpage: r4473 - trunk/pgadmin3/src/schema
Date
Msg-id 200509270909.j8R99FNL011572@developer.pgadmin.org
Whole thread Raw
List pgadmin-hackers
Author: dpage
Date: 2005-09-27 10:09:14 +0100 (Tue, 27 Sep 2005)
New Revision: 4473

Modified:
   trunk/pgadmin3/src/schema/pgSchema.cpp
Log:
Fix system schema handling.

Modified: trunk/pgadmin3/src/schema/pgSchema.cpp
===================================================================
--- trunk/pgadmin3/src/schema/pgSchema.cpp    2005-09-26 21:54:14 UTC (rev 4472)
+++ trunk/pgadmin3/src/schema/pgSchema.cpp    2005-09-27 09:09:14 UTC (rev 4473)
@@ -166,8 +166,8 @@

     pgSet *schemas = collection->GetDatabase()->ExecuteSet(
         wxT("SELECT CASE WHEN nspname LIKE 'pg\\_temp\\_%%' THEN 1\n")
-        wxT("            WHEN nsp.oid<") + NumToStr(collection->GetServer()->GetLastSystemOID()) +
-                         wxT(" OR nspname like 'pg\\_%' THEN 0\n")
+        wxT("            WHEN (nsp.oid<") + NumToStr(collection->GetServer()->GetLastSystemOID()) +
+                         wxT(" OR nspname like 'pg\\_%') AND nspname != 'public' THEN 0\n")
         wxT("            ELSE 3 END AS nsptyp,\n")
         wxT("       nsp.nspname, nsp.oid, pg_get_userbyid(nspowner) AS namespaceowner, nspacl, description,")
         wxT("       has_schema_privilege(nsp.oid, 'CREATE') as cancreate\n")
@@ -182,24 +182,24 @@
         {
             wxString name=schemas->GetVal(wxT("nspname"));
             long nsptyp=schemas->GetLong(wxT("nsptyp"));
-            if (nsptyp == SCHEMATYP_NORMAL)
+
+            wxStringTokenizer tokens(settings->GetSystemSchemas(), wxT(","));
+            while (tokens.HasMoreTokens())
             {
-                wxStringTokenizer tokens(settings->GetSystemSchemas(), wxT(","));
-                while (tokens.HasMoreTokens())
+                wxRegEx regex(tokens.GetNextToken());
+                if (regex.Matches(name))
                 {
-                    wxRegEx regex(tokens.GetNextToken());
-                    if (regex.Matches(name))
-                    {
-                        nsptyp = SCHEMATYP_USERSYS;
-                        break;
-                    }
+                    nsptyp = SCHEMATYP_USERSYS;
+                    break;
                 }
-                if (nsptyp == SCHEMATYP_USERSYS && !settings->GetShowSystemObjects())
-                {
-                    schemas->MoveNext();
-                    continue;
-                }
             }
+
+            if (nsptyp <= SCHEMATYP_USERSYS && !settings->GetShowSystemObjects())
+            {
+                schemas->MoveNext();
+                continue;
+            }
+
             schema = new pgSchema(name);
             schema->iSetSchemaTyp(nsptyp);
             schema->iSetDatabase(collection->GetDatabase());


pgadmin-hackers by date:

Previous
From: Miha Radej
Date:
Subject: cannot disable displaying of system objects
Next
From: "Dave Page"
Date:
Subject: Re: cannot disable displaying of system objects