Database can't be passed explicitly for or/or-join clauses

Hi, when I’m trying to use database in datoms inside or/or-join clauses then datomic throws

Cannot resolve key: $

The query is:

(d/q "[
  :find [?user ...] 
  :in $
  :where 
    (or
        [$ ?user :user/name \"Boby\"] 
        [$ ?user :user/name \"Boby\"]
     )
 ]" (d/db conn))

More interesting things, if to name database using another name:

(d/q "[
  :find [?user ...] 
  :in $someDb
  :where 
    (or
      [$someDb ?user :user/name \"Boby\"] 
      [$someDb ?user :user/name \"Boby\"]
     )
     
 ]" (d/db conn))

Then the response is:

Execution error (Exceptions$IllegalArgumentExceptionInfo) at datomic.error/arg (error.clj:79).
:db.error/invalid-data-source Nil or missing data source. Did you forget to pass a database argument?

Okay, let’s pass default DB too, then the same issue but about $someDb:

(d/q "[
  :find [?user ...] 
  :in $ $someDb
  :where 
    (or
      [$someDb ?user :user/name \"Boby\"] 
      [$someDb ?user :user/name \"Boby\"]
     )
     
 ]" (d/db conn) (d/db conn))
Execution error (IllegalArgumentException) at datomic.datalog/resolve-id (datalog.clj:273).
Cannot resolve key: $someDb

But all works fine if to execute and join even passing only one DB using custom name

(d/q "[
  :find [?user ...] 
  :in $someDb
  :where     
      [$someDb ?user :user/name \"Boby\"] 
      [$someDb ?user :user/name \"Boby\"]
 ]" (d/db conn)) 

Then a success response is returned.

So looks like or join is hardly tied to $ and can’t accept database source passed explicitly .

P.S. Doc says

or clauses target a source named $ unless you specify an explicit src-var .

Datomic: On-Prem:0.9.6045

i think docs say src-var is defined at the OR level, not the nested stmt level

Oh I got, thanks for pointing me to understand what is wrong. Actually my main case is to use different databases in OR-clauses but I see doc says: As with rules, *src-vars* are not currently supported within the clauses of *or* , but are supported on the *or* clause as a whole at top level. and I found something on the internet: https://datomic.narkive.com/H6z769jM/multiple-databases-in-or and on the forum: Rules with multiple data sources?

Query I’m interesting is:

(d/q "[
  :find [?user ...] 
  :in $ $someDb
  :where 

(or-join [?user]

  (and
    [$someDb _ :user/name ?externalName1] 
    [$ ?user :user/name.EN ?externalName1]
  )

  (and
      [$someDb _ :user/name ?externalName2] 
      [$ ?user :user/name.EN ?externalName2]
   )  
 )   
 ]" (d/db conn) (d/db conn))

And looks like the only possible way is to rearrange query to:

(d/q "[
      :find [?user ...] 
      :in $ $someDb
      :where 

    [$someDb _ :user/name ?externalName1]
    [$someDb _ :user/name ?externalName2] 

    (or-join [?user]
      [?user :user/name.EN ?externalName1]
      [?user :user/name.ES ?externalName2]
    )  

]" (d/db conn) (d/db conn)) 

But first case could be more preferable since if first statement from or is true then second part is not executed what is better from performance point

@marshall Could you please tell whether Datomic team is going to support multiply datasource in or clauses?