Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support IS [NOT] UNKNOWN #8933

Closed
Tracked by #112
neverchanje opened this issue Apr 3, 2023 · 2 comments · Fixed by #9965
Closed
Tracked by #112

support IS [NOT] UNKNOWN #8933

neverchanje opened this issue Apr 3, 2023 · 2 comments · Fixed by #9965
Assignees
Labels
component/func-expr Support a SQL function or operator
Milestone

Comments

@neverchanje
Copy link
Contributor

neverchanje commented Apr 3, 2023

Syntax

expression IS UNKNOWN

Description

The IS UNKNOWN predicate in Postgres is used to test if an expression
returns an unknown value, which is typically represented by a NULL.
This predicate can be used with various expressions, such as boolean
expressions, to check if the result is unknown due to the presence of
NULL values.

Parameters

  • expression: The expression to be tested for an unknown value.

Returns

The predicate returns true if the expression result is unknown
(NULL), and false otherwise.

Examples

SELECT (NULL AND true) IS UNKNOWN; -- Returns true
SELECT (NULL AND false) IS UNKNOWN; -- Returns true
SELECT (true AND false) IS UNKNOWN; -- Returns false

In these examples, the IS UNKNOWN predicate tests if the result of
boolean expressions is unknown due to the presence of NULL values.

See Also

  • IS NULL: Tests if an expression returns a NULL value.

  • IS NOT UNKNOWN: Tests if an expression does not return an unknown
    value.

  • COALESCE: Returns the first non-null argument or null if all
    arguments are null.

Compatibility

The IS UNKNOWN predicate is compatible with PostgreSQL and is part of
the SQL standard.

@neverchanje neverchanje changed the title support IS [NOT] UNKNOWN (doc) support IS [NOT] UNKNOWN Apr 3, 2023
@github-actions github-actions bot added this to the release-0.19 milestone Apr 3, 2023
@xiangjinwu
Copy link
Contributor

Notice that IS UNKNOWN and IS NOT UNKNOWN are effectively the same as IS NULL and IS NOT NULL, respectively, except that the input expression must be of Boolean type.

Given we already support IS [NOT] NULL, we just need to check argument type and then bind to the same expr type... and add the missing parser support.

@xiangjinwu xiangjinwu added the component/func-expr Support a SQL function or operator label Apr 4, 2023
@neverchanje
Copy link
Contributor Author

@xiangjinwu Could you assign someone for this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/func-expr Support a SQL function or operator
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants