Modify

Opened 14 years ago

Closed 12 years ago

#7441 closed defect (wontfix)

sqlite2pg dies with an SQL error

Reported by: Joshua Kugler Owned by: John Hampton
Priority: high Component: SqliteToPgScript
Severity: blocker Keywords:
Cc: Trac Release: 0.11

Description

When trying to run sqlite2pg like so:

./sqlite2pg -e /path/to/trac -p postgres://trac:password@localhost/trac

I'm getting this error:

Traceback (most recent call last):
  File "./sqlite2pg", line 335, in <module>
    sys.exit(main(sys.argv[1:]))
  File "./sqlite2pg", line 331, in main
    Main(opts)
  File "./sqlite2pg", line 250, in Main
    rc = tmigration.migrateTable(tname) or rc
  File "./sqlite2pg", line 72, in migrateTable
    rc = self.default_copy(table)
  File "./sqlite2pg", line 93, in default_copy
    pgcur.execute(insert_into, row)
  File "/usr/lib/python2.6/dist-packages/trac/db/util.py", line 64, in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
  File "/usr/lib/python2.6/dist-packages/trac/db/util.py", line 64, in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
psycopg2.InternalError: current transaction is aborted, commands ignored until end of transaction block

According to question "I receive the error current transaction is aborted, commands ignored until end of transaction block and can’t do anything else!" at http://initd.org/psycopg/docs/faq.html it does seem be an error in the SQL queries issued by sqlite2pg.

This is with Trac 0.11.7 on Ubuntu 10.04.

Attachments (0)

Change History (2)

comment:1 Changed 14 years ago by Joshua Kugler

I found the problem. On line 77, in TableMigration.default_copy(), we have this:

        for row in scur:
            rows += 1
            try:
                pgcur.execute(insert_into, row)
            except (ProgrammingError, IntegrityError):
                row_exists += 1
            continue
        if row_exists:
            print "%s of %s rows already existed in the %s table" % \
                  (str(row_exists), str(rows), table)

So, what sqlite2pg tries to do is silence the error, and then report the duplicate row after the fact. In our case, the Integrity error was more values than columns (rogue plugin added a column to a core table), and thus after that error, it could not continue, thus aborted the transaction. However, even though the transaction was aborted, sqlite2pg continued to try to insert rows, thus the error in the original report.

comment:2 Changed 12 years ago by Ryan J Ollos

Resolution: wontfix
Status: newclosed

This plugin is deprecated. See the TracMigratePlugin.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain John Hampton.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.