Fork me on GitHub
#clojure-dev
<
2016-08-25
>
bronsa13:08:51

@seancorfield another issue that come up with that change -- we were returning namespaced column names from sql that were being transformed back into namespaced keywords by the keyword call in java.jdbc. this doesn't work anymore because (name (keyword "foo/bar")) ;=> 'bar while (namespace (keyword nil "foo/bar")) ;=> 'foo/bar

bronsa13:08:34

(example that was working before and is now failing: (let [{:keys [foo/bar]} (jdbc/query conn ["SELECT 1 AS \"foo/bar\""] {:result-set-fn first})] bar) ;=> nil ;; previously returned 1

bronsa13:08:09

I realize java.jdbc now has qualifier but that doesn't do it for some of our queries where we return columns with the same name and different namespace from a query -- AFAIU we can't return :foo/bar and :baz/bar using qualifier

seancorfield16:08:36

@bronsa Interesting… Could you add some notes about that to http://dev.clojure.org/jira/browse/JDBC-140 so I can be sure I have suitable test cases when I work on it? (won’t happen until after Labor Day since my wife & I are traveling quite a bit before then)

bronsa16:08:50

yeah sure, no worries :)

bronsa16:08:06

"you're not supposed to do that" is an acceptable answer btw

seancorfield16:08:17

The change should not have broken anyone’s code — I only added :qualifier because other ways of producing qualified keywords felt a bit hacky 😕

bronsa17:08:07

I think the fix should be simple enough, rather than (keyword qualifier (f x)), something like (if qualifier (keyword qualifier (f x)) (keyword (f x)))

bronsa23:08:57

@seancorfield many thanks for the quick release!

seancorfield23:08:54

I had a window while waiting for other stuff at work 🙂

seancorfield23:08:03

I used your two examples as the basis of three new test cases. Hopefully that also solves your qualified key destructuring / select as foo/bar example since I didn’t verify that one specifically.