Open msirek opened 1 year ago
Postgres also supports multiple !
operators with no whitespace in between, e.g.:
SELECT a FROM a WHERE a @@ '!!foo';
a
-------------------
'bar':4,5 'foo':3
'foo':3
SELECT a FROM a WHERE a @@ '!!!foo';
a
-------------------
'baz':1
'bar':2
'sdf':2
'sdfbar':2
'bar':4,5 'sdf':3
'sdf':2
(6 rows)
SELECT a FROM a WHERE a @@ '!!!!foo';
a
-------------------
'bar':4,5 'foo':3
'foo':3
(2 rows)
The TSQuery parser cannot handle consecutive
!
(NOT) operators separated by whitespace, but this works in Postgres:Wrapping the expression in parentheses works:
SELECT 'fats cats ate fat rats' @@ '!(!(cats | bat & rats))'::tsquery;
Jira issue: CRDB-25562