ITADN

clob-column-reader returns nil when a column has a boolean false value

#299ClosedGAumala 创建于 2025-04-18
G
GAumalacommented
**Describe the bug** In tables with `BOOLEAN` columns, using `clob-column-reader` makes queries return `nil` when the column has a `false` value, even if the column is declared as `NOT NULL`. **To Reproduce** Just create a table with at least one `BOOLEAN` column and insert at least one `false` value. Try to read a row with a `false` value while using `clob-column-reader` Here's a little example you can copy on the REPL: ```clojure (require '[next.jdbc :as jdbc] '[next.jdbc.result-set :as rs] '[next.jdbc.sql :as sql]) ;; Set up datasource to H2 database (def ds (jdbc/get-datasource {:dbtype "h2" :dbname "clob_test"})) ;; Create table with CLOB and BOOLEAN NOT NULL (jdbc/execute! ds [" CREATE TABLE documents ( id INT PRIMARY KEY AUTO_INCREMENT, content CLOB, published BOOLEAN NOT NULL )"]) ;; Insert test data (sql/insert! ds :documents {:content "First document content" :published true}) (sql/insert! ds :documents {:content "Second document content" :published false}) ;; Query with CLOB handling and return raw results (jdbc/execute! ds ["SELECT * FROM documents"] {:builder-fn (rs/as-maps-adapter rs/as-unqualified-lower-maps rs/clob-column-reader)}) ;; => [{:id 1, :content "First document content", :published true} {:id 2, :content "Second document content", :published nil}] ;; the second row has :published nil, it should be false ``` **Expected behavior** `false` values should be returned as `false`, not `nil`.
关闭于 2025-04-18 1 条评论