fix printing of database exception when determining unique ids