Skip to content

Clarify implicit coercion behavior is implementation-defined #97

@alancai98

Description

@alancai98

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions