Hi,
I'm trying to use the TagsPlugin [1] with Trac 1.0 and a PostgreSQL
database, but I always get "environment needs upgrade".
"trac-admin tracenv upgrade" fails with "ProgrammingError: ERROR:
Relation »tags« already exists".
The table "tags" does exist.
Everything works when SQLite is used instead of PostgreSQL. (I just
migrated the database.)
Everything works with PostgreSQL when the tagsplugin is disabled.
Looking at the logs below and at the TagsPlugin source [2] I checked
manually and rollback_is_safe is False. So after the query from the
"wiki_namespace" table that should fail, rollback() is not called. So
PostgreSQL ignores the query from the "tags" table that should
succeed.
I think this is caused by [3], which seems to be related to th:#9521
[4] and #10451 [5].
Does that mean TagsPlugin is broken for PostgreSQL at the moment? Or
am I missing something?
Thanks,
Peter
[1]
http://trac-hacks.org/wiki/TagsPlugin
[2]
http://trac-hacks.org/browser/tagsplugin/trunk/tractags/model.py
[3]
http://trac-hacks.org/changeset/11041
[4]
http://trac-hacks.org/ticket/9521
[5]
http://trac.edgewall.org/ticket/10451
== Versions
* Trac: 1.0dev-r11152
* TagsPlugin: 0.7dev-r11105
* psycopg2: 2.4.5
* PostgreSQL: 9.0
== Logs
* Trac logs the following during the upgrade attempt:
Trac[env] INFO: -------------------------------- environment startup
[Trac 1.0dev-r11152] --------------------------------
Trac[model] ERROR: DatabaseError: ERROR: Current transaction is
aborted, commands ignored until end of transaction block
Trac[env] WARNING: Component <tractags.model.TagModelProvider object
at 0x0307B470> requires environment upgrade
Trac[model] ERROR: DatabaseError: ERROR: Current transaction is
aborted, commands ignored until end of transaction block
Trac[env] INFO: tractags.model.TagModelProvider upgrading...
Trac[model] ERROR: DatabaseError: ERROR: Relation »tags« already exists
Trac[console] ERROR: Exception in trac-admin command
ProgrammingError: ERROR: Relation »tags« already exists
ProgrammingError: ERROR: Relation »tags« already exists
* While PostgreSQL logs:
ERROR: Relation »wiki_namespace« does not exist at character 22
QUERY: SELECT COUNT(*) FROM wiki_namespace
ERROR: Current transaction is aborted, commands ignored until end of
transaction block
QUERY: SELECT COUNT(*) FROM tags
ERROR: Relation »wiki_namespace« does not exist at character 22
QUERY: SELECT COUNT(*) FROM wiki_namespace
ERROR: Current transaction is aborted, commands ignored until end of
transaction block
QUERY: SELECT COUNT(*) FROM tags
ERROR: Relation »tags« already exists
QUERY: CREATE TABLE "tags" (
"tagspace" text,
"name" text,
"tag" text,
CONSTRAINT "tags_pk" PRIMARY KEY ("tagspace","name","tag")
)