Skip to main content
added 230 characters in body
Source Link
Paul White
  • 95.8k
  • 30
  • 442
  • 691

Domain analysis (and any resulting simplification) only works with column-level check constraintscheck constraints.

Any check constraint referencing only a single column is a column-level constraint.

Any check constraint referencing multiple columns is a table-level constraint.

parent_column_id in sys.check_constraints is non-zero for a column-level constraint.

For clarity, it doesn't matter which syntax is used to declare or add the constraint. A check constraint declared at table level, but which references only a single column, will be considered a column-level constraint. Likewise, a check constraint referencing only a single column added after table creation will be added as a column-level constraint.

Yes, this is a 'limitation'. The logic is quite complicated enough when only column-level constraints need to be evaluated against complex query expressions. Expanding this to work for multi-column check constraints would be quite challenging.

That said, early simplifications are deliberately limited to common cases that are cheap and easy to apply. People used to optimizing compilers in programming languages often have different expectations for this sort of thing.

Domain analysis (and any resulting simplification) only works with column-level check constraints.

Any check constraint referencing only a single column is a column-level constraint.

Any check constraint referencing multiple columns is a table-level constraint.

parent_column_id in sys.check_constraints is non-zero for a column-level constraint.

For clarity, it doesn't matter which syntax is used to declare or add the constraint. A check constraint declared at table level, but which references only a single column, will be considered a column-level constraint. Likewise, a check constraint referencing only a single column added after table creation will be added as a column-level constraint.

Yes, this is a 'limitation'. The logic is quite complicated enough when only column-level constraints need to be evaluated against complex query expressions. Expanding this to work for multi-column check constraints would be quite challenging.

Domain analysis (and any resulting simplification) only works with column-level check constraints.

Any check constraint referencing only a single column is a column-level constraint.

Any check constraint referencing multiple columns is a table-level constraint.

parent_column_id in sys.check_constraints is non-zero for a column-level constraint.

For clarity, it doesn't matter which syntax is used to declare or add the constraint. A check constraint declared at table level, but which references only a single column, will be considered a column-level constraint. Likewise, a check constraint referencing only a single column added after table creation will be added as a column-level constraint.

Yes, this is a 'limitation'. The logic is quite complicated enough when only column-level constraints need to be evaluated against complex query expressions. Expanding this to work for multi-column check constraints would be quite challenging.

That said, early simplifications are deliberately limited to common cases that are cheap and easy to apply. People used to optimizing compilers in programming languages often have different expectations for this sort of thing.

Source Link
Paul White
  • 95.8k
  • 30
  • 442
  • 691

Domain analysis (and any resulting simplification) only works with column-level check constraints.

Any check constraint referencing only a single column is a column-level constraint.

Any check constraint referencing multiple columns is a table-level constraint.

parent_column_id in sys.check_constraints is non-zero for a column-level constraint.

For clarity, it doesn't matter which syntax is used to declare or add the constraint. A check constraint declared at table level, but which references only a single column, will be considered a column-level constraint. Likewise, a check constraint referencing only a single column added after table creation will be added as a column-level constraint.

Yes, this is a 'limitation'. The logic is quite complicated enough when only column-level constraints need to be evaluated against complex query expressions. Expanding this to work for multi-column check constraints would be quite challenging.