Opened 17 years ago
Closed 16 years ago
#2929 closed defect (fixed)
Fails to work with postgres database
Reported by: | anonymous | Owned by: | Petr Škoda |
---|---|---|---|
Priority: | normal | Component: | TracDownloaderPlugin |
Severity: | major | Keywords: | postgreSQL TracDownloaderPlugin |
Cc: | Trac Release: | 0.11 |
Description
Using postgres for the database, when the plugin is installed and the system is restarted, the system responds that trac-admin upgrade needs to be performed. When this is done, the following message is generated.
Command failed: current transactions is aborted, commands ignored until end of transaction block
It probably says someplace that the plugin only supports mySQL, but it escaped me. trac version 0.10.3, postgres version 8.1.11, python 2.4.4
Attachments (0)
Change History (5)
comment:1 Changed 17 years ago by
comment:2 Changed 17 years ago by
Hi, please tell me if your problem persists. If so, please send me requested logs.
comment:3 Changed 16 years ago by
After a 'trac-admin upgrade' (postgres 8.2)
execute "SELECT value FROM system WHERE name='database_version'"
execute "SELECT value FROM system WHERE name='database_version'"
execute "SELECT value FROM system WHERE name='discussion_version'"
execute "SELECT value FROM system WHERE name='discussion_version'"
execute 'SELECT 1 FROM downloader_category'
execute 'SELECT 1 FROM downloader_category'
execute "SELECT value FROM system WHERE name='database_version'"
execute "SELECT value FROM system WHERE name='database_version'"
execute "SELECT value FROM system WHERE name='discussion_version'"
execute "SELECT value FROM system WHERE name='discussion_version'"
execute 'SELECT 1 FROM downloader_category'
execute 'SELECT 1 FROM downloader_category'
execute 'CREATE TABLE downloader_category (\n id SERIAL PRIMARY KEY,\n name text,\n notes text,\n sort int,\n timestamp int,\n deleted int\n)'
execute 'CREATE TABLE downloader_category (\n id SERIAL PRIMARY KEY,\n name text,\n notes text,\n sort int,\n timestamp int,\n deleted int\n)'
Command failed: current transaction is aborted, commands ignored until end of transaction block
Also converting from sqlite to postgres gave troubles.
The "sort" column is defined as a integer, but a string is being inserted.
"CREATE TABLE downloader_category (
id integer PRIMARY KEY,
name text,
notes text,
sort integer,
timestamp integer,
deleted integer
);
INSERT INTO "downloader_category" VALUES(1,'Releases',,,1209464907.63672,NULL);"
comment:4 Changed 16 years ago by
Keywords: | postgresSQL TracDownloaderPlugin added |
---|---|
Trac Release: | 0.10 → 0.11 |
the same problem with trac 0.11.1:
Traceback (most recent call last):
File "/usr/bin/trac-admin", line 8, in <module>
load_entry_point('Trac==0.11.1', 'console_scripts', 'trac-admin')()
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/admin/console.py", line 1295, in run
return admin.onecmd(command)
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/admin/console.py", line 123, in onecmd
rv = cmd.Cmd.onecmd(self, line) or 0
File "/usr/lib/python2.5/cmd.py", line 219, in onecmd
return func(arg)
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/admin/console.py", line 1145, in do_upgrade
self.env.upgrade(backup=do_backup)
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/env.py", line 442, in upgrade
participant.upgrade_environment(db)
File "build/bdist.linux-mips64/egg/tracdownloader/admin.py", line 704, in upgrade_environment File "build/bdist.linux-mips64/egg/tracdownloader/db.py", line 83, in upgrade_environment File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/db/util.py", line 51, in execute
return self.cursor.execute(sql)
File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/db/util.py", line 51, in execute
return self.cursor.execute(sql)
psycopg2.InternalError: current transaction is aborted, commands ignored until end of transaction block
comment:5 Changed 16 years ago by
Keywords: | postgreSQL added; postgresSQL removed |
---|---|
Resolution: | → fixed |
Status: | new → closed |
The db.py->DownloaderDB->environment_needs_upgrade:
try: cursor.execute("SELECT 1 FROM downloader_category") except: self.env.log.info("Downloader plug-in DB does not exist.") return True
when the Table doesn't exist, it will raise a ProgrammingError, and the "except ..." block suppresses it. When the backend database is postgreSQL, a ProgrammingError will leave the connection to the DB in an unusable state (connection.get_transaction_status () is 3) see http://code.djangoproject.com/ticket/852
add this line in the exceptions handler should work:
cursor.connection.rollback ()
Hi, please set up logging to warning, try that failing udate again and then send me a log file. Without it I cannot do anything.
Tahnks! Peca