Skip to content

CHECK constraint fails on NOT NULL boolean field #1350

@mahenzon

Description

@mahenzon

Details for the issue

If I create a table with this sample query:

CREATE TABLE "Test tbl" ( id INTEGER NOT NULL, some_check BOOLEAN NOT NULL, PRIMARY KEY (id), CHECK (some_check IN (0, 1)) )

(something like this is generated by SQLAlchemy, when using Boolean field)
There is no way to add any items to this table using DB4S:

But I'm still able to to add items using an SQL query

However if I create a table allowing null in the boolean field:

CREATE TABLE "Test nullable tbl" ( id INTEGER NOT NULL, some_check BOOLEAN, PRIMARY KEY (id), CHECK (some_check IN (0, 1)) )

I'm able to add items using DB4S:

As I see, DB4S tries to insert an empty string to the field.

I assume this is an issue

Useful extra information

I'm opening this issue because:

  • DB4S is crashing
  • DB4S has a bug
  • DB4S needs a feature
  • DB4S has another problem

I'm using DB4S on:

  • Windows: ( version: ___ )
  • Linux: ( distro: ___ )
  • Mac OS: ( version: 10.13.3 (17D47) )
  • Other: ___

I'm using DB4S version:

  • 3.10.1
  • 3.10.0
  • 3.9.1
  • Other: ___

I have also:

Metadata

Metadata

Assignees

Labels

bugConfirmed bugs or reports that are very likely to be bugs.constraints & foreign keys

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions