Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Pull with attr-name not in schema differs from Datomic #579

Open
KsVlad opened this issue Nov 10, 2022 · 0 comments
Open

[Bug]: Pull with attr-name not in schema differs from Datomic #579

KsVlad opened this issue Nov 10, 2022 · 0 comments
Labels
bug Something isn't working datomic compat triage

Comments

@KsVlad
Copy link

KsVlad commented Nov 10, 2022

What version of Datahike are you using?

0.6.1521

What version of Java are you using?

openjdk version "19.0.1" 2022-10-18

What operating system are you using?

Arch WSL (Windows 11)

What database EDN configuration are you using?

{:store {:backend :mem}}

Describe the bug

In Datomic explicit pull for attribute missing in schema filters out that attribute in result. There is some mention in specification , not quite sound about "missing in schema" though.

In Datahike explicit pull for attribute missing in schema throws with

; Execution error (ExceptionInfo) at datahike.db.utils/validate-attr-ident (utils.cljc:157).
; Bad entity attribute :some at (resolve-datom db 5 :some nil nil), not defined in current schema

What is the expected behaviour?

Same as in Datomic

How can the behaviour be reproduced?

Datomic

(require '[datomic.client.api :as dm])

(def client (dm/client {:server-type :dev-local
                        :system "dev"}))

(dm/create-database client {:db-name "test"})

(def conn (dm/connect client {:db-name "test"}))

(def schema [{:db/ident :present
              :db/valueType :db.type/string
              :db/cardinality :db.cardinality/one
              :db/unique :db.unique/identity}])

(dm/transact conn {:tx-data schema})

(dm/transact conn {:tx-data [{:present "value"}]})

(dm/pull (dm/db conn) '[:missing :present] [:present "value"])
>
{:present "value"}

Datahike

(require '[datahike.api :as d])

(def cfg {:store {:backend :mem}})
(d/create-database cfg)
(def conn (d/connect cfg))

(def schema [{:db/ident :present
              :db/valueType :db.type/string
              :db/cardinality :db.cardinality/one
              :db/unique :db.unique/identity}])

(d/transact conn schema)

(d/transact conn [{:present "value"}])

(d/pull (d/db conn) '[:missing :present] [:present "value"])
>
; Execution error (ExceptionInfo) at datahike.db.utils/validate-attr-ident (utils.cljc:157).
; Bad entity attribute :missing at (resolve-datom db 2 :missing nil nil), not defined in current schema
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working datomic compat triage
Projects
Status: No status
Development

No branches or pull requests

2 participants