Skip to content

CREATE DOMAIN and ALTER DOMAIN do not validate the default value #8303

Open
@mrotteveel

Description

@mrotteveel

CREATE DOMAIN does not evaluate the default value for validity, which makes it possible to create a domain with an invalid default:

create domain ts_invalid timestamp default '  .  .       :  :  ';

Result: no error
Expected:

Statement failed, SQLSTATE = 22018
conversion error from string " . . : : "

Same happens for ALTER DOMAIN if the domain is not yet used for a NOT NULL column.

create domain ts_invalid;
alter domain ts_invalid set default  '  .  .       :  :  ';

Result: no error
Expected:

Statement failed, SQLSTATE = 22018
conversion error from string " . . : : "

If you then attempt to create a table with this domain as a nullable column, it works, until you insert with default values. If you create a table with the domain as a not null column, it fails. The ALTER DOMAIN does fail if the domain was already used for a NOT NULL column.

I would expect Firebird to validate if the DEFAULT expression produces a valid value of the domain type.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions