Modify

Opened 3 years ago

Closed 2 years ago

#9698 closed defect (invalid)

invalid input syntax for integer: "timeline.authors"

Reported by: zoltan@… Owned by: pacopablo
Priority: normal Component: SqliteToPgScript
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description

Hi, I tried to convert my trac/sqlite database into PostgreSQL, but there is an error:

$ ./sqlite2pg -e /var/trac -p 'postgres://trac:trac@localhost/trac'
Exception AssertionError: AssertionError() in <bound method PooledConnection.__del__ of <trac.db.pool.PooledConnection object at 0x21e7418>> ignored
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/lib64/python2.7/site-packages/Trac-0.13dev_r10849-py2.7.egg/trac/db/util.py", line 65, in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
psycopg2.DataError: invalid input syntax for integer: "timeline.authors"
LINE 1: ...INTO session VALUES ('c86170f57c3062a3d0ba73b3',0,'timeline....
                                                             ^

I am using PostgreSQL 9.1.1 and psycopg 2.4.2 on Gentoo Linux.

I got an almost empty database with the following number of entries in the tables:

  • auth_cookie - 1
  • component - 2
  • enum - 13
  • milestone - 4
  • permission - 24
  • report - 8
  • system - 3
  • version - 2

Thanks for any help in advance!

Attachments (0)

Change History (2)

comment:1 Changed 3 years ago by zoltan@…

The same problem with PostgreSQL 8.4.10:

zoltan@geogebra ~/trac-pg $ ./sqlite2pg -e /var/trac -p 'postgres://trac:trac@localhost/trac'
Exception AssertionError: AssertionError() in <bound method PooledConnection.__del__ of <trac.db.pool.PooledConnection object at 0x21ae418>> ignored
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/lib64/python2.7/site-packages/Trac-0.13dev_r10849-py2.7.egg/trac/db/util.py", line 65, in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
psycopg2.DataError: invalid input syntax for integer: "timeline.authors"
LINE 1: ...NTO session VALUES (E'c86170f57c3062a3d0ba73b3',0,E'timeline...

These are the server side PostgreSQL logs:

ERROR:  relation "system" does not exist at character 19
STATEMENT:  select value from system where name = 'database_version'
ERROR:  invalid input syntax for integer: "timeline.authors" at character 59
STATEMENT:  INSERT INTO session VALUES (E'c86170f57c3062a3d0ba73b3',0,E'timeline.authors')

It seems the last column should be an integer (session.last_visit), but for some reason a text type datum wants to be inserted.

comment:2 Changed 2 years ago by anonymous

  • Resolution set to invalid
  • Status changed from new to closed

The SQLite3 database was corrupted. I had to remove the invalid rows, then the migration script worked well. (In fact the error message came from Trac, since it was unable to handle an invalid entry in the session table.)

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from pacopablo. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.