erlangbureau / jamdb_oracle

Oracle Database driver for Erlang
MIT License
104 stars 48 forks source link

Expressions in select maps not understood by Oracle 19c #147

Closed dfrese closed 8 months ago

dfrese commented 1 year ago

Running a query like this

from f in "foo",
  select: %{
    res: f.a == 1
  }

gets translated into SQL like

SELECT (a = 1) as res FROM foo

which at least my Oracle 19c does not support. (ORA-00907: missing right parenthesis)

A minor issue, as it can be worked around in this case with a fragment and a 'CAST' expression, but this works with the Postgresql Ecto adapter for example.

Greetings, David

vstavskyi commented 1 year ago

What the result of f.a == 1? Boolean?

dfrese commented 1 year ago

In Postgres? Yes.

Something like

select: %{
  res: f.myint + 5
}

works, btw.

vstavskyi commented 1 year ago

In Oracle boolean is rare

vstavskyi commented 11 months ago

In 23c

select  dump(1=2), dump(1=1), 1=1  from dual []
{:ok,
 %{
   columns: ["DUMP(1=2)", "DUMP(1=1)", "1=1"],
   num_rows: 1,
   rows: [["Typ=252 Len=1: 0", "Typ=252 Len=1: 1", 1]]
 }}