← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 600964] Re: using "search" orm method querying uppercase columns, produces PostgreSQL error "column TABLE.COLUMN does not exist"

 

Thanks for the suggestion, we can keep this wishlist improvement for
after v6.0.

** Changed in: openobject-server
   Importance: Undecided => Wishlist

** Changed in: openobject-server
       Status: Triaged => Confirmed

** Changed in: openobject-server
     Assignee: (unassigned) => OpenERP's Framework R&D (openerp-dev-framework)

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/600964

Title:
  using "search" orm method querying uppercase columns, produces PostgreSQL error "column TABLE.COLUMN does not exist"

Status in OpenObject Server:
  Confirmed

Bug description:
  Using upper case field name causes PostgreSQL error while searching it.

For instance, if you create a new object "custom.object" with an integer field "FIELD" and try searching it with
self.pool.get('custom.object').search(cr, uid, [('FIELD', '=', 1)])
PostgreSQL will tell "ERROR:  column custom_object.field does not exist".

According to PostgreSQL documentation http://www.postgresql.org/docs/8.4/static/sql-syntax-lexical.html , "unquoted names are always folded to lower case. For example, the identifiers FOO, foo, and "foo" are considered the same by PostgreSQL, but "Foo"  and "FOO" are different from these three and each other"

By first analysis, I solved modifying the "__leaf_to_sql" method of "expression" class ( http://bazaar.launchpad.net/~openerp/openobject-server/trunk/annotate/2458/bin/osv/expression.py#L342 ) replacing every
%s.%s
with
"%s"."%s"