erlangbureau / jamdb_oracle

Oracle Database driver for Erlang
MIT License
103 stars 46 forks source link

Problem inserting boolean values via Ecto.Repo/Schema #150

Closed dfrese closed 5 months ago

dfrese commented 9 months ago

Hi,

I created a table in Oracle 19c, via Ecto.Migration with a boolean column, which got created as CHAR(1) via

  defp ecto_to_db(:boolean),             do: "char"

in jamdb_oracle_query.ex.

But inserting a row via Ecto.Repo and a corresponding schema with a :boolean column seems not to do anything with true/false. I see this in the log output:

INSERT INTO .... [true]

and get

ORA-12899: value too large for column ... (actual: 2, maximum: 1)

as the error message. (Not sure why it says 'actual: 2' and not 'actual: 4')

Note: using :string in the Ecto.Schema, and converting to and from booleans in my application is a workaround, I thing. I know that Oracle introduced proper booleans much later (23 I think), but maybe the current 'partial support' for booleans could be fixed? (Fixed to 'char(1)' for not, but eventually configurable what to use instead of booleans?)

If not, I would appreciate a hint to where the Repo.insert and update (and probably where?) statements could be adjusted in the jamdb code. Then I could do a fix that just "works for me", in my fork.

Greets, David

vstavskyi commented 9 months ago

fixed