Skip to content

Commit

Permalink
fix array of null handling
Browse files Browse the repository at this point in the history
 * fixes handling of arrays with null elmemts

 * also, return nil two places where we used to return :null
  • Loading branch information
slyrus authored and marijnh committed Oct 24, 2016
1 parent fc15297 commit 160ba03
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 0 additions & 4 deletions cl-postgres/interpret.lisp
Expand Up @@ -191,10 +191,6 @@ executing body so that row values will be returned as t."
;; Should we return nil or a (make-array nil) when num-dims is
;; 0? Returning nil for now.
nil)
((plusp has-null)
(error "According to the code in arrayfuns.c/array_send, this
shouldn't happen. Please report this error to the cl-postgres
developers."))
(t
(let* ((array-dims
(loop for i below num-dims
Expand Down
6 changes: 6 additions & 0 deletions cl-postgres/tests.lisp
Expand Up @@ -602,6 +602,12 @@
(is (equalp (exec-query connection "select row((ARRAY[1,3,4])[5:99])" 'list-row-reader)
'(((NIL))))))))

(test row-array-nulls-binary-2
(with-test-connection
(cl-postgres::with-binary-row-values
(is (equalp (exec-query connection "select row(ARRAY[NULL, NULL]);" 'list-row-reader)
'(((#(:null :null)))))))))

(test row-array-table-nulls-binary
(with-binary-row-values
(with-test-connection
Expand Down

0 comments on commit 160ba03

Please sign in to comment.