Skip to content

Commit

Permalink
YugaByte: default values are just plain broken
Browse files Browse the repository at this point in the history
  • Loading branch information
aphyr committed Sep 5, 2019
1 parent 5468da0 commit d9e6a09
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions yugabyte/src/yugabyte/default_value.clj
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,17 @@
(gen/stagger 1/100)))

(defn bad-row
"Is this particular row illegal--e.g. does it contain a `null`?"
"Is this particular row illegal--e.g. does it contain a `null`? Returns row
if true."
[row]
(some nil? (vals row)))
(and (seq (filter nil? (vals row)))
row))

(defn bad-table
"Does this collection of rows have a bad row in it? If so, returns that row,
otherwise nil."
[table]
(some bad-row table))
(seq (filter bad-row table)))

(defn bad-read
"Does this read op have a bad row in it? Returns that row if so, otherwise
Expand Down
4 changes: 2 additions & 2 deletions yugabyte/src/yugabyte/ysql/default_value.clj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
(defn insert!
"Inserts a row into a table."
[conn table]
(c/execute! conn [(str "insert into " table " DEFAULT VALUES")]))
(c/execute! conn [(str "insert into " table " (dummy) values (?)") 1]))

(defn read-ordered
"Reads every value in table ordered by k."
Expand All @@ -44,7 +44,7 @@
[conn table]
(try
(c/execute! conn (j/create-table-ddl table
[[:k :serial :primary :key]
[[:dummy :int]
[:v :int :default "0"]]
{:conditional? true}))
(catch org.postgresql.util.PSQLException e
Expand Down

0 comments on commit d9e6a09

Please sign in to comment.