Edgewall Software
Modify

Opened 15 years ago

Closed 15 years ago

Last modified 12 years ago

#9253 closed defect (invalid)

"IntegrityError: ticket.id may not be NULL" error when creating a ticket

Reported by: wadud.miah@… Owned by:
Priority: normal Milestone:
Component: general Version: 0.11.2.1
Severity: normal Keywords: IntegrityError
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

I am getting the following error message when trying to create a ticket:

IntegrityError: ticket.id may not be NULL

The back end database was converted from Postgres to SQLite. Here are some other details about my set up:

Trac: 0.11.2.1 Python: 2.4.3 (#1, Jun 11 2009, 14:09:37) [GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] setuptools: 0.6c5 SQLite: 3.3.6 pysqlite: 1.1.7 Genshi: 0.5.1 mod_python: 3.2.8 Subversion: 1.5.5 (r34862) jQuery: 1.2.6

Thanks in advance.

Attachments (0)

Change History (5)

comment:1 by Remy Blank, 15 years ago

Resolution: invalid
Status: newclosed

I'm pretty sure this is due to the autoindex sequences in PostgreSQL not being set-up correctly by the conversion process. See #8575 for a similar symptom and how to fix the issue.

Off the top of my head, you'll probably need to do the following, assuming your schema is already correct (completely untested, so keep a backup around):

SELECT setval('ticket_id_seq', (SELECT MAX(id) FROM ticket));
SELECT setval('report_id_seq', (SELECT MAX(id) FROM report));

Anyway, we don't officially support database backend conversions, so this is not a bug in Trac. You may get more help on the MailingList and / or IrcChannel.

comment:2 by Remy Blank, 15 years ago

You may also want to check that the ticket.id and report.id columns are set up as auto-incrementing.

comment:3 by wadud.miah@…, 15 years ago

I think the code you have given my is for MySQL. Do you know the equivalent SQLite code? Thanks.

comment:4 by Remy Blank, 15 years ago

Oh, sorry, I misread the description and thought you converted from SQLite to PostgreSQL, when you actually did the opposite.

Make sure the id column of the ticket and report tables is of type "integer PRIMARY KEY". Other than that, I don't know.

in reply to:  4 comment:5 by Genesis2001, 12 years ago

Replying to rblank:

Oh, sorry, I misread the description and thought you converted from SQLite to PostgreSQL, when you actually did the opposite.

Make sure the id column of the ticket and report tables is of type "integer PRIMARY KEY". Other than that, I don't know.

For posterity, in addition to this, make sure to allow null for ticket.id in the SQLite3 database. I converted from a MySQL Database down to a SQLite3 database and the program I used to migrate left the mysql schemas mostly active, converting datatypes over only.

Last edited 12 years ago by Remy Blank (previous) (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.