I use OpenLDAP + PostgreSQL as a sql backend. Just for tests if hyphens are supported I defined object class and attribute having hyphen in the names:
[...]
, hutton,o=sql,c=ru> backsql_id2entry(): retrieving all attributes ==>backsql_get_attr_vals(): oc="person-oc" attr="ref" keyval=12478 ==>backsql_get_attr_vals(): oc="person-oc" attr="objectClass" keyval=12478 ==>backsql_get_attr_vals(): oc="person-oc" attr="person-type" keyval=12478 backsql_get_attr_values(): error executing attribute query "SELECT persons.name AS person-type FROM persons WHERE persons.id=? ORDER BY persons.name" Return code: -1 Native error code: 7 SQL engine state: 42601 Message: ERROR: syntax error at or near "-"; Error while executing the query
Looks that hyphen is not allowed in attribute name. Is it any workaround for this to support "-" in attribute names?
back-sql allows whatever is legal LDAP in attribute names. Looks like the hyphen is not allowed by the underlying RDBMS. The short answer is "don't use hyphens unless tolerated by the underlying RDBMS". Perhaps the construct "AS " could be changed into "AS ''", as soon as the RDBMS allows it. Yet another customization parameter in back-sql... sigh.
p.
Thanks for the prompt answer. I tried to perform queries in the database using AS 'attr-name' and AS "attr-name" - both don't work. But even if they work, is the sql statement generator configurable somehow (at least for attribute queries) so the statements could be customized?
Forgot to add that I am using windows compiled version (v2.2.29), so not very fresh...
Regards, Greg