diff --git a/dialects/postgresql/src/main/kotlin/app/cash/sqldelight/dialects/postgresql/grammar/PostgreSql.bnf b/dialects/postgresql/src/main/kotlin/app/cash/sqldelight/dialects/postgresql/grammar/PostgreSql.bnf index 6ec34c0a456..50f85881755 100644 --- a/dialects/postgresql/src/main/kotlin/app/cash/sqldelight/dialects/postgresql/grammar/PostgreSql.bnf +++ b/dialects/postgresql/src/main/kotlin/app/cash/sqldelight/dialects/postgresql/grammar/PostgreSql.bnf @@ -242,12 +242,14 @@ compound_select_stmt ::= [ {with_clause} ] {select_stmt} ( {compound_operator} override = true } -extension_expr ::= json_expression | boolean_literal { +extension_expr ::= json_expression | boolean_literal | boolean_not_expression { extends = "com.alecstrong.sql.psi.core.psi.impl.SqlExtensionExprImpl" implements = "com.alecstrong.sql.psi.core.psi.SqlExtensionExpr" override = true } +boolean_not_expression ::= NOT (boolean_literal | {column_name}) + boolean_literal ::= TRUE | FALSE json_expression ::= {column_name} ( jsona_binary_operator | jsonb_binary_operator ) <> { diff --git a/dialects/postgresql/src/test/fixtures_postgresql/column_types/Sample.s b/dialects/postgresql/src/test/fixtures_postgresql/column_types/Sample.s index 35f218ceca1..e9fa7af66be 100644 --- a/dialects/postgresql/src/test/fixtures_postgresql/column_types/Sample.s +++ b/dialects/postgresql/src/test/fixtures_postgresql/column_types/Sample.s @@ -62,3 +62,6 @@ CREATE TABLE all_types( some_int2_array INT2[] ); + +SELECT * FROM all_types +WHERE NOT some_boolean AND NOT some_bool = some_boolean AND NOT TRUE;