cockroachdb / cockroachdb/cockroach

QA: plainto_tsquery can't parse !!, &&, ||, <->, etc.

Open
#99,588 0 comments 0 reactions 0 assignees View on GitHub
C-bug O-qa T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

Postgres ignores non-alphanumeric symbols in the argument to `plainto_tsquery`, but CRDB does not,
e.g.
```sql
postgres=# select plainto_tsquery('fat !! bat');
plainto_tsquery
-----------------
'fat' & 'bat'
(1 row)

postgres=# select plainto_tsquery('fat &&& bat');
plainto_tsquery
-----------------
'fat' & 'bat'
(1 row)

postgres=# select plainto_tsquery('fat ) bat');
plainto_tsquery
-----------------
'fat' & 'bat'
(1 row)

postgres=# select plainto_tsquery('fat && bat');
plainto_tsquery
-----------------
'fat' & 'bat'
(1 row)

postgres=# select plainto_tsquery('fat || bat');
plainto_tsquery
-----------------
'fat' & 'bat'
(1 row)

postgres=# select plainto_tsquery('fat <-> bat');
plainto_tsquery
-----------------
'fat' & 'bat'
(1 row)
```
All of these examples return a syntax error on CRDB, e.g.
```sql
root@localhost:26257/defaultdb> select plainto_tsquery('fat <-> bat');
ERROR: plainto_tsquery(): syntax error in TSQuery: fat <-> bat
SQLSTATE: 42601
```

Jira issue: CRDB-25956

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.