Skip to content

SQL: add NULL-specific functions #34956

@costin

Description

@costin

With NULL a first class citizen, we need to add NULL specific functions, some standard, some extensions, to ease its handling. This is a meta-ticket around the functions planned:

  • COALESCE SQL: Implement COALESCE function #35060
    The most generic form of null checking with fallback.
  • IFNULL/ISNULL/NVL
    2 argument variant of COALESCE (IFNULL is a MySQL variant and an ODBC system function, ISNULL is a MS-SQL server variant and NVL comes from Oracle). NVL in particular needs to pay attention to the Oracle semantics.
  • NULLIF
    Takes 2 arguments and returns NULL if the 2 arguments are equal, otherwise it returns the 1st one.
  • <=> or null-safe equals
    This needs investigating as the standard SQL for it seems to be IS (NOT) DISTINCT FROM. H2 has a variation of it x IS (NOT) y.
    MySQL variant is the most popular though.
  • GREATEST/LEAST
    Non-standard SQL but implemented by a number of DBs.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions