Skip to content

Cell editor doesn't treat INTEGER, NUMERIC inputs right for INSERT or UPDATE #1952

@mbraeutigam

Description

@mbraeutigam

Details for the issue

What did you do?

Created a table with CHECK-constraints and inserted data.

DROP TABLE IF EXISTS TEST;
CREATE TABLE TEST (VST INTEGER CONSTRAINT TEST_VST CHECK(typeof(VST)='integer' and VST>=0 and VST<=BST or typeof(VST)='null'),BST INTEGER CONSTRAINT TEST_BST CHECK(typeof(BST)='integer' and BST>=0 and BST>=VST or typeof(BST)='null'), OBJEKTID TEXT UNIQUE);

insert into TEST(VST,BST,OBJEKTID) VALUES (0,200,'A'); -- OK

update TEST set VST=100 WHERE OBJEKTID='A'; -- OK
update TEST set VST=201 WHERE OBJEKTID='A'; -- CONSTRAINT ERROR as supposed, OK

After that, going into the Browse data tab / cell editor and trying to change the value of VST to 50 there will be a constraint error. This happens, because the cell editor tries to update the value as TEXT instead of INTEGER. I know it is possible by how SQLite works, but shouldn't the editor try to parse for the declared storage class in the table definitions and insert/update it as the declared storage class?

What did you expect to see?

Inserting/Updating data as the declared storage class from the table column (table cell edit and cell editor window), if it is parseable as the declared storage class (e.g. via typeof-Check). If not parseable as declared then insert as TEXT.

Right clicking on a value in a table cell of column VST of the previously via SQL inserted values > Copy as SQL should output

INSERT INTO "main"."TEST" ("VST") VALUES (100);

By the way I am not asking the same as mentioned in #622.
My request is not to check for the correct types when inserting but to insert the correct type if the input in the cell editor is correctly parseable.

What did you see instead?

Right clicking on the table cell of the previously via SQL inserted values > Copy as SQL outputs

INSERT INTO "main"."TEST" ("VST") VALUES ('100');

So as expected the value in the cell is treated as TEXT instead of the defined and inserted INTEGER.

Useful extra information

The info below often helps, please fill it out if you're able to. :)

What operating system are you using?

  • Windows: ( version: 10 Pro 64bit )
  • Linux: ( distro: ___ )
  • Mac OS: ( version: ___ )
  • Other: ___

What is your DB4S version?

  • 3.11.2
  • 3.11.1
  • 3.10.1
  • Other: ___

Did you also

Metadata

Metadata

Labels

bugConfirmed bugs or reports that are very likely to be bugs.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions