The line "user text," causes the syntax error. I can find no indication that the string "user" is reserved as a keyword or function in this version of Postgres, but it's my guess that this is the case. I am able to add the same table as long as I change all instances of the string "user" in this CREATE statement to say something else.

I am not sure if this is an issue with TracForge or the sqlite2pg script; it could be that the Tracforge schema is ill-suited for Postgres, but it may also be that the script is misreading something. I'll post a link to this ticket with the TracForge developers.

Attachments (0)

Change History (5)

I tried to set up a new project with Tracforge using Postgres 8.1 and it failed during the initenv with a similar error, so I don't think this is a sqlite2pg script problem.

I poked around some more and it looks like "user" is indeed a keyword as per the ​SQL standard. I've included a patch for the Tracforge code which replaces relevant instances of "user" with "tfuser" in two tracforge files (tracforge/admin/model.py and tracforge/admin/db_default.py):

I haven't had time to look into this error just yet and won't for a few days more, but will get back to you as soon as I can.

As for the Postgres schema issue, sqlite2pg may want to account for this change for legacy support, unless there's a better way around it.

In either case, please let me know if either developer plans to institute these changes. My organization is very interested in using TracForge, but will require the use of Postgres (or MySQL, pending stable support) and we do have some legacy SQLite-based tracs. If there's anything I can do to help speed up fixes as they become available, please let me know.

The second bug (the one involving 'SubscriptionManager') turns out to be caused by environment_needs_upgrade() in tracforge/subscriptions/manager.py not being called.

This is because (I think) trac/env.py will call manager.py's environment_created() which, in turn, just calls upgrade_environment(). The problem is that environment_needs_upgrade() instantiates found_db_version which upgrade_environment() requires, but tracforge/subscriptions/manager.py ends up calling upgrade_environment() immediately upon creation, before it calls environement_needs_upgrade().

Hence found_db_version is not instantiated and initializing a Trac environment with TracForge enabled in the global trac.ini throws this exception.

One fix would be to place a call to environment_needs_upgrade() just before the call to upgrade_environment() in manger.py's environment_created() routine (line 72ish). Here's a potential patch:

Add Comment

This ticket has been modified since you started editing. You should review the
other modifications which have been appended above,
and any conflicts shown in the preview below.
You can nevertheless proceed and submit your changes if you wish so.