-
Norvald H. Ryeng authored
Problem: ALTER TABLE ADD/MODIFY COLUMN may create geometry columns with invalid data. Geometry value validation was implemented in the fix for bug #19593342 and checks all values inserted into a geometry field with Field::store(). However, in some cases, ALTER TABLE bypasses Field::store(), and thereby also the validation. Fix: Return an error when trying to add NOT NULL geometry type columns, or trying to convert nullable columns of other types to NOT NULL geometry types, if the table is not empty. Use do_conv_blob() to copy geometry fields if the types aren't guaranteed to match. Since there is no default value, ALTER TABLE ADD COLUMN can only add a geometry column if the table is empty or the column is nullable. ALTER TABLE MODIFY COLUMN can only change a column to a geometry type if all values in the column can be interpreted as a valid value of that type.
Norvald H. Ryeng authoredProblem: ALTER TABLE ADD/MODIFY COLUMN may create geometry columns with invalid data. Geometry value validation was implemented in the fix for bug #19593342 and checks all values inserted into a geometry field with Field::store(). However, in some cases, ALTER TABLE bypasses Field::store(), and thereby also the validation. Fix: Return an error when trying to add NOT NULL geometry type columns, or trying to convert nullable columns of other types to NOT NULL geometry types, if the table is not empty. Use do_conv_blob() to copy geometry fields if the types aren't guaranteed to match. Since there is no default value, ALTER TABLE ADD COLUMN can only add a geometry column if the table is empty or the column is nullable. ALTER TABLE MODIFY COLUMN can only change a column to a geometry type if all values in the column can be interpreted as a valid value of that type.
Loading