#3308 closed defect (fixed)
"relation "system" does not exist" when using multiple Postgres schema in same DB
Reported by: | Owned by: | Jonas Borgström | |
---|---|---|---|
Priority: | normal | Milestone: | 0.10 |
Component: | general | Version: | devel |
Severity: | major | Keywords: | schema, relation, system, feedback, postgresql |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description (last modified by )
When using one Postgres DB with multiple schemas with Trac projects, there is must be "public" schema containing "system" table. In other words, database_version is wrongly checked against public schema, not schema of project.
I think problem is here:
File "/usr/lib/python2.4/site-packages/trac/env.py", line 235, in get_version cursor.execute("SELECT value FROM system WHERE name='database_version'")
Maybe schema specification before "system" needed?
Attachments (0)
Change History (7)
comment:1 by , 19 years ago
comment:2 by , 19 years ago
Status: | new → assigned |
---|
As soon as a new postgresql connection is established the search path is set to first look in the specified schema and after that "public".
The most likely explanation for this error message is that an incorrect schema name (or non at all) is specified in the database connection string. Can you please verify that you have a connection string like this in your trac.ini:
database = postgres:///database?schema=yourschemaname or database = postgres://user:pass@server/database?schema=yourschemaname
comment:3 by , 19 years ago
Description: | modified (diff) |
---|---|
Keywords: | feedback added |
comment:4 by , 18 years ago
No, database connection string is correct. It is:
database = postgres://tracdbuser:tracdbpwd@localhost/tracdb?schema=myproj
When there are also public schema (created via trac-admin) in database tracdb - everything is fine: it works with "myproj" schema.
But after renaming or deleting public schema, trac.cgi
prints following for "myproj" project:
Oops... Trac detected an internal error: relation "system" does not exist Traceback (most recent call last): File "/var/www/html/dev/yttrium/trac.cgi", line 20, in ? cgi_frontend.run() File "/usr/lib/python2.4/site-packages/trac/web/cgi_frontend.py", line 68, in run gateway.run(dispatch_request) File "/usr/lib/python2.4/site-packages/trac/web/wsgi.py", line 87, in run response = application(self.environ, self._start_response) File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 303, in dispatch_request env = _open_environment(env_path, run_once=environ['wsgi.run_once']) File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 50, in _open_environment return open_environment(env_path) File "/usr/lib/python2.4/site-packages/trac/env.py", line 432, in open_environment if env.needs_upgrade(): File "/usr/lib/python2.4/site-packages/trac/env.py", line 312, in needs_upgrade if participant.environment_needs_upgrade(db): File "/usr/lib/python2.4/site-packages/trac/env.py", line 366, in environment_needs_upgrade dbver = self.env.get_version(db) File "/usr/lib/python2.4/site-packages/trac/env.py", line 235, in get_version cursor.execute("SELECT value FROM system WHERE name='database_version'") File "/usr/lib/python2.4/site-packages/trac/db/util.py", line 48, in execute return self.cursor.execute(sql) File "/usr/lib/python2.4/site-packages/trac/db/util.py", line 48, in execute return self.cursor.execute(sql) ProgrammingError: relation "system" does not exist
But "system" table exist both in "public" and "myproj" schemas and in both of them have correct database_version value.
comment:6 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Okay, I now think I understand what happens. This error occured because you removed the "public" schema but Trac unnecessarly assumed that this schema would always exist.
As of [3574] Trac no longer assumes that the public schema always exists.
comment:7 by , 10 years ago
Keywords: | postgresql added; postgres removed |
---|
Wrongly checked, I mean.