title: Slapd with back-sql in docker only retrieves attribute mapping for one object class
body: <p>When I try to set up an LDAP server in Docker using SLAPD and connect it to a PostgreSQL Docker with the example database, only the attribute mapping for the first object class is loaded.</p>
  
  <p>The following log is produced:</p>
  
  <pre><code>ldaptest_ldap_1      | 57938399 backsql_load_schema_map(): oc_query "SELECT id,name,keytbl,keycol,create_proc,delete_proc,expect_return FROM ldap_oc_mappings"
  ldaptest_ldap_1      | 57938399 objectClass: id="1" name="inetOrgPerson" keytbl="persons" keycol="id" create_proc="SELECT create_person()" create_keyval="" delete_proc="DELETE FROM persons WHERE id=?" expect_return="0"create_hint=""
  ldaptest_ldap_1      | 57938399 backsql_load_schema_map(): objectClass "inetOrgPerson":
  ldaptest_ldap_1      |     keytbl="persons" keycol="id"
  ldaptest_ldap_1      | 57938399     create_proc="SELECT create_person()"
  ldaptest_ldap_1      | 57938399     delete_proc="DELETE FROM persons WHERE id=?"
  ldaptest_ldap_1      | 57938399     expect_return: add=0, del=0; attributes:
  ldaptest_ldap_1      | 57938399 objectClass: id="2" name="document" keytbl="documents" keycol="id" create_proc="SELECT create_doc()" create_keyval="" delete_proc="DELETE FROM documents WHERE id=?" expect_return="0"create_hint=""
  ldaptest_ldap_1      | 57938399 backsql_load_schema_map(): objectClass "document":
  ldaptest_ldap_1      |     keytbl="documents" keycol="id"
  ldaptest_ldap_1      | 57938399     create_proc="SELECT create_doc()"
  ldaptest_ldap_1      | 57938399     delete_proc="DELETE FROM documents WHERE id=?"
  ldaptest_ldap_1      | 57938399     expect_return: add=0, del=0; attributes:
  ldaptest_ldap_1      | 57938399 objectClass: id="3" name="organization" keytbl="institutes" keycol="id" create_proc="SELECT create_o()" create_keyval="" delete_proc="DELETE FROM institutes WHERE id=?" expect_return="0"create_hint=""
  ldaptest_ldap_1      | 57938399 backsql_load_schema_map(): objectClass "organization":
  ldaptest_ldap_1      |     keytbl="institutes" keycol="id"
  ldaptest_ldap_1      | 57938399     create_proc="SELECT create_o()"
  ldaptest_ldap_1      | 57938399     delete_proc="DELETE FROM institutes WHERE id=?"
  ldaptest_ldap_1      | 57938399     expect_return: add=0, del=0; attributes:
  ldaptest_ldap_1      | 57938399 objectClass: id="4" name="referral" keytbl="referrals" keycol="id" create_proc="SELECT create_referral()" create_keyval="" delete_proc="DELETE FROM referrals WHERE id=?" expect_return="0"create_hint=""
  ldaptest_ldap_1      | 57938399 backsql_load_schema_map(): objectClass "referral":
  ldaptest_ldap_1      |     keytbl="referrals" keycol="id"
  ldaptest_ldap_1      | 57938399     create_proc="SELECT create_referral()"
  ldaptest_ldap_1      | 57938399     delete_proc="DELETE FROM referrals WHERE id=?"
  ldaptest_ldap_1      | 57938399     expect_return: add=0, del=0; attributes:
  ldaptest_ldap_1      | 57938399 backsql_load_schema_map(): at_query "SELECT name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return,sel_expr_u FROM ldap_attr_mappings WHERE oc_map_id=?"
  ldaptest_ldap_1      | 57938399 backsql_oc_get_attr_mapping(): executing at_query
  ldaptest_ldap_1      |     "SELECT name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return,sel_expr_u FROM ldap_attr_mappings WHERE oc_map_id=?"
  ldaptest_ldap_1      |     for objectClass "document"
  ldaptest_ldap_1      |     with param oc_id=2
  ldaptest_ldap_1      | 57938399 attributeType: name="description" sel_expr="documents.abstract" from="documents" join_where="" add_proc="UPDATE documents SET abstract=? WHERE id=?" delete_proc="UPDATE documents SET abstract='' WHERE abstract=? AND id=?" sel_expr_u=""
  ldaptest_ldap_1      | 57938399 backsql_oc_get_attr_mapping(): preconstructed query "SELECT documents.abstract AS description FROM documents WHERE documents.id=? ORDER BY description"
  ldaptest_ldap_1      | 57938399 attributeType: name="documentTitle" sel_expr="documents.title" from="documents" join_where="" add_proc="UPDATE documents SET title=? WHERE id=?" delete_proc="UPDATE documents SET title='' WHERE title=? AND id=?" sel_expr_u=""
  ldaptest_ldap_1      | 57938399 backsql_oc_get_attr_mapping(): preconstructed query "SELECT documents.title AS documentTitle FROM documents WHERE documents.id=? ORDER BY documentTitle"
  ldaptest_ldap_1      | 57938399 attributeType: name="documentAuthor" sel_expr="documentAuthor.dn" from="ldap_entries AS documentAuthor,documents,authors_docs,persons" join_where="documentAuthor.keyval=persons.id AND documentAuthor.oc_map_id=1 AND authors_docs.doc_id=documents.id AND aut
  ldaptest_ldap_1      | 57938399 backsql_oc_get_attr_mapping(): preconstructed query "SELECT documentAuthor.dn AS documentAuthor FROM ldap_entries AS documentAuthor,documents,authors_docs,persons WHERE documents.id=? AND documentAuthor.keyval=persons.id AND documentAuthor.oc_map_id=1 AND authors_docs.doc_id=documents.id AND authors_docs.pers_id=persons.id ORDER BY documentAuthor"
  ldaptest_ldap_1      | 57938399 attributeType: name="documentIdentifier" sel_expr="'document '||text(documents.id)" from="documents" join_where="documentAuthor.keyval=persons.id AND documentAuthor.oc_map_id=1 AND authors_docs.doc_id=documents.id AND authors_docs.pers_id=persons.id" add_
  ldaptest_ldap_1      | 57938399 backsql_oc_get_attr_mapping(): preconstructed query "SELECT 'document '||text(documents.id) AS documentIdentifier FROM documents WHERE documents.id=? ORDER BY documentIdentifier"
  ldaptest_ldap_1      | 57938399 backsql_load_schema_map("document"): autoadding 'objectClass' and 'ref' mappings
  ldaptest_ldap_1      | 57938399 backsql_oc_get_attr_mapping(): executing at_query
  ldaptest_ldap_1      |     "SELECT name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return,sel_expr_u FROM ldap_attr_mappings WHERE oc_map_id=?"
  ldaptest_ldap_1      |     for objectClass "referral"
  ldaptest_ldap_1      |     with param oc_id=4
  ldaptest_ldap_1      | 57938399 backsql_load_schema_map("referral"): autoadding 'objectClass' and 'ref' mappings
  ldaptest_ldap_1      | 57938399 backsql_oc_get_attr_mapping(): executing at_query
  ldaptest_ldap_1      |     "SELECT name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return,sel_expr_u FROM ldap_attr_mappings WHERE oc_map_id=?"
  ldaptest_ldap_1      |     for objectClass "organization"
  ldaptest_ldap_1      |     with param oc_id=3
  ldaptest_ldap_1      | 57938399 backsql_load_schema_map("organization"): autoadding 'objectClass' and 'ref' mappings
  ldaptest_ldap_1      | 57938399 backsql_oc_get_attr_mapping(): executing at_query
  ldaptest_ldap_1      |     "SELECT name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return,sel_expr_u FROM ldap_attr_mappings WHERE oc_map_id=?"
  ldaptest_ldap_1      |     for objectClass "inetOrgPerson"
  ldaptest_ldap_1      |     with param oc_id=1
  ldaptest_ldap_1      | 57938399 backsql_load_schema_map("inetOrgPerson"): autoadding 'objectClass' and 'ref' mappings
  </code></pre>
  
  <p>As can be seen from the log, only the attribute mapping for the document object class is loaded. And not for the referral, organization and inetOrgPerson document class.</p>
  
  <p>I created a GitHub repository with my docker and docker-compose configuration:
  <a href="https://github.com/arnogeurts/ldaptest">https://github.com/arnogeurts/ldaptest</a></p>