Closed el-wiss closed 5 months ago
I cannot reproduce. When I import this model:
INTERLIS 2.3;
MODEL Booltest (de)
AT "http://modelbaker.ch"
VERSION "2024-06-17" =
TOPIC Booltest =
CLASS Booltest =
NullBool : BOOLEAN;
NotNullBool : MANDATORY BOOLEAN;
END Booltest;
END Booltest;
END Booltest.
My settings are this:
And this:
So it does not set the constraint on where it's not needed...
But there is something else: When you allow null in QGIS it still sets it always to false. To allow null you have to activate it:
But I don't think that's your problem @el-wiss What Model Baker version you are using? Have you tested with the most recent official version?
Your're right, thanks for reproducing. I used version 7.8.4. - seems like i've mixed up similarly named attributes within a model after a long day's work. I retested it today and ended up with your result.
The well known QGIS issue (qgis showing "false" in attribute table on NULL-values in boolean fields) is still a nuisance, but that's not a model baker issue.
INTERLIS makes a distinction between a MANDATORY BOOLEAN and a BOOLEAN. The latter allows its value to be NULL. This is also possible in both PostGIS (true/false/NULL) and GeoPackage (0/1/NULL). The following screenshot shows the corresponding table from the GeoPackage specification: https://www.geopackage.org/spec/
However, the model baker import always sets a NOT NULL-constraint when importing a BOOLEAN attribute from INTERLIS, This behaviour cannot be altered (except in PostGIS by manually removing the constraint via SQL statement after importing the schema).
true/false/NULL boolean type situations often exist in the real world and both INTERLIS and the databases allow them to be modeled as such. Therefore, model baker should offer an option for this behaviour to be (de)selected by the users.