[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#3629) patch for problem with aggregated attributes in sql-back



Full_Name: Kjell-Magne Oierud
Version: 2.2.24
OS: linux
URL: ftp://ftp.openldap.org/incoming/kjell-magne-oierud-050404.patch.1
Submission from: (NULL) (80.232.36.140)


Hi,

I've upped a patchfile named kjell-magne-oierud-050404.patch.1 in
ftp.openldap.org/incoming
It's a patch against servers/slapd/back-sql/schema-map.c

The problem:

sql-back fails if you define some of an objectclass' attributes to be
aggregates. More precisely, if you in ldap_attr_mapings define sel_expr to be
anything like SUM(foo). sql-back will then try to exequte queries with invalid
ORDER BY clauses: 
  SELECT SUM(foo) AS bar ... ORDER BY SUM(foo)
                                      ^^^^^^^^

The solution:

My patch fixes this by instead using the alias:
  SELECT SUM(foo) AS bar ... ORDER BY bar
                                      ^^^
Regards,
 Kjell-Magne Oierud