-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: operator precedence does not match PostgreSQL #66866
Copy link
Copy link
Open
Labels
C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.O-communityOriginated from the communityOriginated from the communityT-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)SQL Foundations Team (formerly SQL Schema + SQL Sessions)X-blathers-triagedblathers was able to find an ownerblathers was able to find an owner
Description
Unfortunately, CockroachDB does not match PostgreSQL's order of operations. An example of this is here: #64699 (comment) and is detailed here: #66866 (comment)
Changing the order of operations is dangerous and will be very broken for backwards compatibility. However, if we want PostgreSQL compatibility we need to do it. One for the record books...
Describe the problem
When I made a test for #66861, I found the order of operation of OPERATOR(pg_config.X) is not same.
root@localhost:26257/postgres> SELECT 'a' || 'b' = 'ab';
?column?
------------
true
(1 row)
root@localhost:26257/postgres> SELECT 'a' || 'b' OPERATOR(pg_catalog.=) 'ab';
?column?
------------
afalse
(1 row)
By the way, the result of executing the same queries with postgresql ver 13.3 is the following.
psql=# SELECT 'a' || 'b' = 'ab';
?column?
----------
t
(1 row)
psql=# SELECT 'a' || 'b' OPERATOR(pg_catalog.=) 'ab';
?column?
----------
t
(1 row)
To Reproduce
Execute the above example.
Expected behavior
I think this should be the same order of operations. Thought?
Environment:
- CockroachDB version: master branch(c4f134c)
- Server OS: MacOS BigSur
- Client app:
cockroach sql
Jira issue: CRDB-8268
Epic CRDB-60814
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.O-communityOriginated from the communityOriginated from the communityT-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)SQL Foundations Team (formerly SQL Schema + SQL Sessions)X-blathers-triagedblathers was able to find an ownerblathers was able to find an owner