erlangbureau / jamdb_oracle

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

SQL syntax error in insert_all and with_cte #168

Closed dfrese closed 10 months ago

dfrese commented 11 months ago

An insert_all with a query of the data to be inserted, which has a 'CTE', generates an SQL string like

sql INSERT INTO foo (WITH bar AS ...)

which gives me an Oracle error

ORA-32034: unsupported use of WITH clause

Removing the braces around the WITH works, which can be achieved by changing the insert_all clause in jamdb_oracle_query.ex to:

   defp insert_all(query = %Ecto.Query{}, _counter) do
     [all(query)]
   end

(cte_query in line 253 adds braces too, but that didn't seem relevant here)

vstavskyi commented 11 months ago

fix