[Trac-tickets] Re: [The Trac Project] #2164: DB error when submitting Custom Query using custom fields against Postgres

The Trac Project noreply at edgewall.com
Wed Oct 19 12:10:23 CDT 2005


#2164: DB error when submitting Custom Query using custom fields against Postgres
-------------------------------------+--------------------------------------
 Reporter:  abudinsz at nascentric.com  |        Owner:  daniel
     Type:  defect                   |       Status:  closed
 Priority:  high                     |    Milestone:        
Component:  report system            |      Version:  0.9b2 
 Severity:  critical                 |   Resolution:  fixed 
 Keywords:  postgresql custom query  |  
-------------------------------------+--------------------------------------
Comment (by anonymous):

 {{{
 #!diff

 Index: /usr/src/trac-devel/trac/trac/ticket/query.py
 ===================================================================
 --- /usr/src/trac-devel/trac/trac/ticket/query.py       (revision 2318)
 +++ /usr/src/trac-devel/trac/trac/ticket/query.py       (working copy)
 @@ -211,6 +211,8 @@
              value = sql_escape(value[len(mode and '!' or '' + mode):])
              if name not in custom_fields:
                  name = 't.' + name
 +           else:
 +               name= name+'.value'
              if mode == '~' and value:
                  return "COALESCE(%s,'') %sLIKE '%%%s%%'" % (
                         name, neg and 'NOT ' or '', value)
 @@ -240,7 +242,7 @@
                  if k not in custom_fields:
                      col = 't.'+k
                  else:
 -                    col = k
 +                    col = k+'.value'
                  clauses.append("COALESCE(%s,'') %sIN (%s)"
                                 % (col, neg and 'NOT ' or '', inlist))
              elif len(v) > 1:
 @@ -269,7 +271,7 @@
              if name not in custom_fields:
                  col = 't.'+name
              else:
 -                col = name
 +                col = name+'.value'
              if name == 'id':
                  # FIXME: This is a somewhat ugly hack.  Can we also have
 the
                  #        column type for this?  If it's an integer, we do
 first
 }}}

-- 
Ticket URL: <http://projects.edgewall.com/trac/ticket/2164>
The Trac Project <http://trac.edgewall.com/>


More information about the Trac-Tickets mailing list