Edgewall Software
Modify

Ticket #3675 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

When adding a severity, I get an SQL syntax error

Reported by: anonymous Owned by: mgood
Priority: normal Milestone: 0.10
Component: admin/console Version: 0.10b1
Severity: normal Keywords: needinfo
Cc: trac@…
Release Notes:
API Changes:

Description

The command and error looks like:

trac-admin /path/to/project/ severity add annoying
Command failed: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'int)),0),'severity','annoying' FROM enum WHERE type='severity at line 1")

Attachments

Change History

comment:1 Changed 5 years ago by mgood

  • Keywords needinfo added

Have you upgraded Trac from the trunk? I believe this may be the same issue as #3669 with the recently introduced use of CAST.

comment:2 follow-up: Changed 5 years ago by trac@…

  • Cc trac@… added

After updating past r3690, trac doesn't work with mysql anymore. The problem is that

select cast(1 as int);

doesn't work in mysql.

The following patch works for me

  • trac/db/mysql_backend.py

     
    145147        ConnectionWrapper.__init__(self, cnx) 
    146148 
    147149    def cast(self, column, type): 
     150       if type == 'int': 
     151           type = 'signed' 
    148152        return 'CAST(%s AS %s)' % (column, type) 
    149153 
    150154    def like(self): 

comment:3 in reply to: ↑ 2 Changed 5 years ago by mgood

  • Milestone set to 0.10
  • Owner changed from daniel to mgood
  • Status changed from new to assigned

Replying to trac@erre.user.lysator.liu.se:

After updating past r3690, trac doesn't work with mysql anymore. The problem is that

select cast(1 as int);

doesn't work in mysql.

Hmm, there was an existing cast before r3690, so I don't know why this just popped up, but the patch looks ok.

comment:4 Changed 5 years ago by mgood

  • Resolution set to fixed
  • Status changed from assigned to closed

Ok, patch applied in r3716.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from mgood. Next status will be 'closed'
Author


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

 
Note: See TracTickets for help on using tickets.