Closed jmcardon closed 2 months ago
The following test, prior to this PR, fails on the sqlite pact db (but works fine for in-memory):
(begin-tx) (module m g (defcap g () true) (defschema sc a:integer b:integer) (deftable tbl:{sc}) (defun add-elem(a:integer k:string) (write tbl k {"a":a, "b":a}) ) (defun update-elem(a:integer k:string) (update tbl k {"a":a}) ) (defun all-elems() (fold-db tbl (lambda (x y) true) (lambda (k o) {"key":k, "value":o})) ) ) (create-table tbl) (commit-tx) ; Add two entries (begin-tx) (m.add-elem 1 "jose") (m.add-elem 1 "robert") (commit-tx) (begin-tx) (m.update-elem 2 "jose") (m.update-elem 3 "robert") (commit-tx) (begin-tx) (expect "All-elems return distinct objects" [ {"key": "jose","value": {"a": 2,"b": 1}} , {"key": "robert","value": {"a": 3,"b": 1}} ] (m.all-elems)) (commit-tx)
This PR fixes this behavior. The keys method in the sqlite pact db was not calling DISTINCT on the entries.
keys
DISTINCT
Thanks @salamaashoush for the report!! This was found via the pact -s
PR checklist:
db.repl
Additionally, please justify why you should or should not do the following:
The following test, prior to this PR, fails on the sqlite pact db (but works fine for in-memory):
This PR fixes this behavior. The
keys
method in the sqlite pact db was not callingDISTINCT
on the entries.Thanks @salamaashoush for the report!! This was found via the pact -s
PR checklist:
db.repl
Additionally, please justify why you should or should not do the following: