-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Public schema should not be mandatory #4
Comments
I guess I've been so used to the presence of the 'public' schema that it seemed mandatory and, in a sense, much easier to design Pyrseas as if it was that way. I do recall reading that it can be dropped, but wondered "who would do such a thing?" In any case, you're correct. The docs even say 'public' is not even part of the SQL Standard. It may take a while for this to be fixed, but I'll look into it. |
I have the folllowing change that is mostly a workaround. I've tested it on a database where I dropped schema 'public' and it seems to work. diff --git a/pyrseas/dbconn.py b/pyrseas/dbconn.py
index d5de750..a74748d 100644
--- a/pyrseas/dbconn.py
+++ b/pyrseas/dbconn.py
@@ -48,7 +48,11 @@ class DbConnection(object):
self.host, self.port, self.dbname,
self.user or os.getenv("USER")),
connection_factory=DictConnection)
- self._execute("set search_path to public, pg_catalog")
+ try:
+ self._execute("set search_path to public, pg_catalog")
+ except:
+ self.conn.rollback()
+ self._execute("set search_path to pg_catalog")
self._version = int(self.fetchone("SHOW server_version_num")[0])
def _execute(self, query): If you could test from the above, I'd appreciate it. |
Works like a charm. I tested it with and without public schema. |
* pyrseas/dbconn.py (DbConnection.connect): If set search_path fails with public schema, try again without it.
The text was updated successfully, but these errors were encountered: