Skip to content

sql: 'infinity'::time should be greater than any other time #129148

@XiaochenCui

Description

@XiaochenCui

In the current implementation, 'infinity'::time is equal to '23:59:59.999999' and smaller than '24:00:00'.
We should make it greater than any other time to fit the semantics of 'infinity', and the updated behaviour will also aligne with pr #127141

demo@127.0.0.1:26257/demoapp/movr> SELECT 'infinity'::time = '23:59:59.999999'::time;
  ?column?
------------
     t

demo@127.0.0.1:26257/demoapp/movr> SELECT 'infinity'::time < '24:00:00'::time;
  ?column?
------------
     t

Alternatively, we can align it's behaviour with postgres, which prohibits 'infinity'::time:

postgres=# SELECT 'infinity'::time;
ERROR:  invalid input syntax for type time: "infinity"
LINE 1: SELECT 'infinity'::time;
               ^
postgres=# SELECT 'infinity'::time > '23:59:59.999999'::time;
ERROR:  invalid input syntax for type time: "infinity"
LINE 1: SELECT 'infinity'::time > '23:59:59.999999'::time;

This issue complements issue #41564

Jira issue: CRDB-41399

Epic CRDB-60811

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)O-communityOriginated from the communityT-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)X-blathers-triagedblathers was able to find an owner

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions