Edgewall Software

Ticket #3675 (closed defect: fixed)

Opened 2 years ago

Last modified 2 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@…

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

  Changed 2 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.

follow-up: ↓ 3   Changed 2 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): 

in reply to: ↑ 2   Changed 2 years ago by mgood

  • owner changed from daniel to mgood
  • status changed from new to assigned
  • milestone set to 0.10

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.

  Changed 2 years ago by mgood

  • status changed from assigned to closed
  • resolution set to fixed

Ok, patch applied in r3716.

Add/Change #3675 (When adding a severity, I get an SQL syntax error)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from mgood. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.