sql: allow DEFAULT/ON UPDATE types that can be assignment-cast to column type #74854
Labels
C-enhancement
Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
sync-me-8
T-sql-foundations
SQL Foundations Team (formerly SQL Schema + SQL Sessions)
T-sql-queries
SQL Queries Team
Projects
Postgres allows creating a DEFAULT column expression of a type that is different from the column's type, as long as the type of the DEFAULT expression can be assignment-cast to the column type. CRDB does not currently allow this.
Example: FLOAT4 -> INT4 casts are allowed in assignment contexts
In Postgres:
In CRDB:
We also support ON UPDATE expressions (which Postgres does not) and these should also allowed to be typed as any type that can be assignment-cast to the column's type.
We must take care to disallow altering a column to a type which cannot be assignment-casted from the types of the DEFAULT and ON UPDATE expressions.
Example: FLOAT4 -> BOOL casts are NOT allowed in assignment contexts
In Postgres:
Jira issue: CRDB-12293
The text was updated successfully, but these errors were encountered: