Modify

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11028 closed defect (invalid)

OperationalError: ambiguous column name: id

Reported by: Ryan J Ollos Owned by: Chris Nelson
Priority: normal Component: TracJsGanttPlugin
Severity: normal Keywords:
Cc: mlm@… Trac Release: 1.0

Description

How to Reproduce

While doing a POST operation on /newticket, Trac issued an internal error.

(please provide additional details here)

Request parameters:

{'__FORM_TOKEN': u'5e5bc52cee75efac19dd14a7',
 'field_blockedby': u'',
 'field_blocking': u'',
 'field_cc': u'',
 'field_component': u'component1',
 'field_description': u'',
 'field_due_assign': u'',
 'field_due_close': u'',
 'field_estimatedhours': u'',
 'field_keywords': u'',
 'field_milestone': u'',
 'field_owner': u'user1',
 'field_parents': u'',
 'field_priority': u'major',
 'field_reporter': u'user1',
 'field_summary': u'fsadfdasfsad',
 'field_totalhours': u'',
 'field_type': u'defect',
 'field_version': u'',
 'submit': u'Create ticket'}

User agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.68 Safari/537.17

System Information

Trac 1.0.2dev
Genshi 0.6 (without speedups)
pysqlite 2.6.0
Python 2.7.3 (default, Jan 2 2013, 13:56:14)
[GCC 4.7.2]
pytz 2012c
setuptools 0.6
SQLite 3.7.13
jQuery 1.7.2

Enabled Plugins

Trac-jsGantt 0.10

Python Traceback

Traceback (most recent call last):
  File "/home/user/Workspace/th10966/trac.git/trac/web/main.py", line 497, in _dispatch_request
    dispatcher.dispatch(req)
  File "/home/user/Workspace/th10966/trac.git/trac/web/main.py", line 214, in dispatch
    resp = chosen_handler.process_request(req)
  File "/home/user/Workspace/th10966/trac.git/trac/ticket/web_ui.py", line 180, in process_request
    return self._process_newticket_request(req)
  File "/home/user/Workspace/th10966/trac.git/trac/ticket/web_ui.py", line 465, in _process_newticket_request
    self._do_create(req, ticket) # (redirected if successful)
  File "/home/user/Workspace/th10966/trac.git/trac/ticket/web_ui.py", line 1289, in _do_create
    ticket.insert()
  File "/home/user/Workspace/th10966/trac.git/trac/ticket/model.py", line 256, in insert
    listener.ticket_created(self)
  File "/home/user/Workspace/trac-hacks.git/tracjsganttplugin/0.11/tracjsgantt/tracpm.py", line 2943, in ticket_created
    self.rescheduleTickets(ticket, {})
  File "/home/user/Workspace/trac-hacks.git/tracjsganttplugin/0.11/tracjsgantt/tracpm.py", line 2753, in rescheduleTickets
    tickets = self.queryTickets(ids)
  File "/home/user/Workspace/trac-hacks.git/tracjsganttplugin/0.11/tracjsgantt/tracpm.py", line 2549, in queryTickets
    return self.pm.query(options, set())
  File "/home/user/Workspace/trac-hacks.git/tracjsganttplugin/0.11/tracjsgantt/tracpm.py", line 1193, in query
    tickets = query.execute(req)
  File "/home/user/Workspace/th10966/trac.git/trac/ticket/query.py", line 302, in execute
    self.num_items = self._count(sql, args)
  File "/home/user/Workspace/th10966/trac.git/trac/ticket/query.py", line 283, in _count
    % sql, args)[0][0]
  File "/home/user/Workspace/th10966/trac.git/trac/db/api.py", line 122, in execute
    return db.execute(query, params)
  File "/home/user/Workspace/th10966/trac.git/trac/db/util.py", line 121, in execute
    cursor.execute(query, params)
  File "/home/user/Workspace/th10966/trac.git/trac/db/util.py", line 65, in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
  File "/home/user/Workspace/th10966/trac.git/trac/db/sqlite_backend.py", line 78, in execute
    result = PyFormatCursor.execute(self, *args)
  File "/home/user/Workspace/th10966/trac.git/trac/db/sqlite_backend.py", line 56, in execute
    args or [])
  File "/home/user/Workspace/th10966/trac.git/trac/db/sqlite_backend.py", line 48, in _rollback_on_error
    return function(self, *args, **kwargs)
OperationalError: ambiguous column name: id

Attachments (0)

Change History (4)

comment:1 Changed 11 years ago by Ryan J Ollos

It looks like, at least in Trac 1.0.2dev, id should be replaced with ticketid.

comment:2 Changed 11 years ago by Jun Omae

Oh... The changes, trac:r11753 and trac:r11754, may break the compatibilities in Query module.

Ryan, could you please apply the following patch and retry?

  • trac/ticket/query.py

    diff --git a/trac/ticket/query.py b/trac/ticket/query.py
    index 4d20da3..fc306bc 100644
    a b class Query(object): 
    461461
    462462        # Join with ticket_custom table as necessary
    463463        if any(k in custom_fields for k in cols):
    464             sql.append("\n  LEFT JOIN (SELECT id")
     464            sql.append("\n  LEFT JOIN (SELECT id AS ticket")
    465465            sql.extend(",\n    (SELECT c.value FROM ticket_custom c "
    466466                       "WHERE c.ticket=t.id AND c.name='%s') AS %s"
    467467                       % (k, db.quote(k))
    468468                       for k in cols if k in custom_fields)
    469             sql.append("\n    FROM ticket t) AS c ON (c.id=t.id)")
     469            sql.append("\n    FROM ticket t) AS c ON (c.ticket=t.id)")
    470470
    471471        # Join with the enum table for proper sorting
    472472        for col in [c for c in enum_columns

comment:3 Changed 11 years ago by Jun Omae

Resolution: invalid
Status: newclosed

Reproduced without this plugin. The issue is a Trac issue. See trac:ticket:11140#comment:4.

comment:4 Changed 11 years ago by Ryan J Ollos

Thanks, Jun. I'll track that ticket.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Chris Nelson.
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.