--- src/schema/pgDatabase.cpp.orig Tue Jan 16 03:14:44 2007 +++ src/schema/pgDatabase.cpp Tue Jan 16 03:15:42 2007 @@ -467,11 +467,11 @@ if (!collection->GetServer()->GetDbRestriction().IsEmpty()) { if (restr.IsEmpty()) - restr = wxT(" WHERE ("); + restr = wxT(" WHERE datname='"); else - restr = wxT(" AND ("); + restr = wxT(" AND datname='"); - restr += collection->GetServer()->GetDbRestriction() + wxT(")\n"); + restr += collection->GetServer()->GetDbRestriction() + wxT("'"); } if (collection->GetConnection()->BackendMinimumVersion(7, 5)) --- src/schema/pgSchema.cpp.orig Tue Jan 16 03:28:51 2007 +++ src/schema/pgSchema.cpp Tue Jan 16 03:30:18 2007 @@ -167,10 +167,10 @@ if (!collection->GetDatabase()->GetSchemaRestriction().IsEmpty()) { if (restr.IsEmpty()) - restr += wxT(" WHERE ("); + restr += wxT(" WHERE datname='"); else - restr += wxT(" AND ("); - restr += collection->GetDatabase()->GetSchemaRestriction() + wxT(")"); + restr += wxT(" AND datname='"); + restr += collection->GetDatabase()->GetSchemaRestriction() + wxT("'"); } wxString sql; --- src/dlg/dlgServer.cpp.orig Tue Jan 16 03:16:08 2007 +++ src/dlg/dlgServer.cpp Tue Jan 16 03:19:52 2007 @@ -157,7 +157,7 @@ wxString sql=wxT("EXPLAIN SELECT 1 FROM pg_database DB\n"); if (connection->BackendMinimumVersion(8, 0)) sql += wxT(" JOIN pg_tablespace ta ON db.dattablespace=ta.OID\n"); - sql += wxT(" WHERE (") + txtDbRestriction->GetValue() + wxT(")"); + sql += wxT(" WHERE datname='") + txtDbRestriction->GetValue() + wxT("'"); wxLogNull nix; --- src/dlg/dlgDatabase.cpp.orig Tue Jan 16 03:18:33 2007 +++ src/dlg/dlgDatabase.cpp Tue Jan 16 03:19:30 2007 @@ -247,7 +247,7 @@ { wxString sql=wxT("EXPLAIN SELECT 1 FROM pg_namespace nsp\n") wxT(" JOIN pg_description des ON des.objoid=nsp.oid\n") - wxT(" WHERE (") + txtSchemaRestr->GetValue() + wxT(")"); + wxT(" WHERE datname='") + txtSchemaRestr->GetValue() + wxT("'"); wxLogNull nix; wxString result=connection->ExecuteScalar(sql);