[JDBC-101] Don't make column names unique when `as-arrays?` is true Created: 16/Oct/14 Updated: 16/Oct/14
|Reporter:||Ragnar Dahlen||Assignee:||Sean Corfield|
result-set-seq ensures that column name keys are unique by suffixing identical column names with an incrementing integer. This is important and required when returning maps as key collisions are possible (result sets can easily contain multiple columns with same label, in different positions) and would yield surprising results.
However, when result-set-seq is called with :as-arrays? true, rows are returned as vectors with the columns ordered as in the SQL query. The first row returned is a vector of column names. In the current implementation, column name keys are still made unique.
I find this behaviour unhelpful as it introduces an unnecessary difference between column names as returned by the query and what they are called in the column name row.
I propose the following change:
When as-arrays? is true, don't make column names unique. This is obviously breaking change if you rely on the uniquified column names (unlikely?). If this is considered a too big risk, I propose we introduce an option to toggle this behaviour uniquify-column-names?, defaulting to true.
|Comment by Ragnar Dahlen [ 16/Oct/14 4:49 AM ]|
Attached initial go at a patch, taking the less conservative approach and changing the current behaviour.
|Comment by Sean Corfield [ 16/Oct/14 10:08 AM ]|
I'd want to survey some of the java.jdbc users who rely on `as-arrays?` before changing the default behavior but I can see the value in suppressing the uniqueness behavior.