-
Notifications
You must be signed in to change notification settings - Fork 1
Description
After discussion with @almann, the PartiQL specification could clarify that implicit coercions across data type families (e.g. comparing an int literal with a string literal 1 < '2') is an implementation-defined feature.
The SQL99 spec defines the comparability of a limited number of types in section 4.12 “Type conversions and mixing of data types”.
- Numbers with numbers
- Character strings with character strings
- Datetimes with datetimes as long as they have the same set of datetime fields (e.g. DATE with DATE, TIME with other TIME types, TIMESTAMP with other TIMESTAMP types)
- Can compare TIME WITH TIMEZONE with TIME WITHOUT TIMEZONE
- (other type X with type X)
There isn't specified behavior on what implicit coercions are permitted/disallowed by a SQL implementation for functions/operations in general. Similarly, the PartiQL spec could reiterate that this is an implementation-defined behavior.
The later section 12.6 on "Coercion of literals for SQL compatibility" defines an equivalence between 9 < '10' and 9 < 10 should clarify that "an implementation that defines implicit coercion rules could opt to do this coercion". PartiQL implementations are not required to do such a coercion if they do not perform any implicit coercions between type families.