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

sql: INET special operators do not work with ANY #24495

Open
petermattis opened this issue Apr 5, 2018 · 3 comments
Open

sql: INET special operators do not work with ANY #24495

petermattis opened this issue Apr 5, 2018 · 3 comments
Labels
A-sql-builtins SQL built-in functions and semantics thereof. A-sql-optimizer SQL logical planning and optimizations. A-sql-pgcompat Semantic compatibility with PostgreSQL C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. E-starter Might be suitable for a starter project for new employees or team members. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)

Comments

@petermattis
Copy link
Collaborator

petermattis commented Apr 5, 2018

The INET special operators such as <<= and >>= do not work with ANY. For example,

root@localhost:26257/> SELECT INET '192.168.1/24' <<= ANY (SELECT INET '192.168.1/24');
invalid syntax: statement ignored: syntax error at or near "any"
DETAIL: source SQL:
SELECT INET '192.168.1/24' <<= ANY (SELECT INET '192.168.1/24');
                               ^

The above query works fine in Postgres. Non-INET specific operators that have INET overloads work with ANY:

root@localhost:26257/> SELECT INET '192.168.1/24' = ANY (SELECT INET '192.168.1/24');
+--------------------------------+
|   INET '192.168.1/24' = ANY    |
|  (SELECT INET '192.168.1/24')  |
+--------------------------------+
|              true              |
+--------------------------------+
(1 row)

Jira issue: CRDB-5761

@petermattis petermattis added this to the 2.0 milestone Apr 5, 2018
@petermattis petermattis modified the milestones: 2.0, 2.0.x Apr 5, 2018
@jordanlewis jordanlewis removed their assignment Apr 5, 2018
@petermattis petermattis added this to the 2.1 milestone Apr 5, 2018
@knz knz added A-sql-optimizer SQL logical planning and optimizations. C-performance Perf of queries or internals. Solution not expected to change functional behavior. labels May 12, 2018
@andy-kimball andy-kimball added this to Higher Priority Backlog in BACKLOG, NO NEW ISSUES: SQL Optimizer Aug 25, 2018
@jordanlewis jordanlewis added A-sql-builtins SQL built-in functions and semantics thereof. C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) and removed C-performance Perf of queries or internals. Solution not expected to change functional behavior. labels Sep 5, 2018
@jordanlewis jordanlewis modified the milestones: 2.1, 2.2 Sep 5, 2018
@petermattis petermattis removed this from the 2.2 milestone Oct 5, 2018
@jordanlewis jordanlewis added the E-starter Might be suitable for a starter project for new employees or team members. label May 23, 2019
@RaduBerinde RaduBerinde moved this from Higher Priority Backlog to Functional issues in BACKLOG, NO NEW ISSUES: SQL Optimizer Apr 18, 2020
@github-actions
Copy link

github-actions bot commented Jun 7, 2021

We have marked this issue as stale because it has been inactive for
18 months. If this issue is still relevant, removing the stale label
or adding a comment will keep it active. Otherwise, we'll close it in
5 days to keep the issue queue tidy. Thank you for your contribution
to CockroachDB!

@knz knz added A-sql-pgcompat Semantic compatibility with PostgreSQL C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. and removed C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) no-issue-activity labels Jun 7, 2021
@knz knz unassigned justinj Jun 7, 2021
@knz knz added this to Triage in SQL Sessions - Deprecated via automation Jun 7, 2021
@knz
Copy link
Contributor

knz commented Jun 7, 2021

This is an outright syntax bug which is still present in 21.1

@jlinder jlinder added T-sql-queries SQL Queries Team T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) labels Jun 16, 2021
@rafiss rafiss moved this from Triage to Longer term backlog in SQL Sessions - Deprecated Jul 27, 2021
@msloan-pckt
Copy link

still an issue with 22.1.0

Checking a table that might have an inet[] type and looking for if an element has some overlap works in Postgres but will fail in CRDB.

This works in Postgres.

select inet '192.168.1.5' << any (array['192.168.1/24', '10/8']::inet[]);

in cockroach this fails with.

SQLSTATE: 42601
DETAIL: source SQL:
select inet '192.168.1.5' << any (array['192.168.1/24', '10/8']::inet[])
                                                                        ^

@exalate-issue-sync exalate-issue-sync bot removed the T-sql-queries SQL Queries Team label Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-builtins SQL built-in functions and semantics thereof. A-sql-optimizer SQL logical planning and optimizations. A-sql-pgcompat Semantic compatibility with PostgreSQL C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. E-starter Might be suitable for a starter project for new employees or team members. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Projects
SQL Sessions - Deprecated
Longer term backlog
Development

No branches or pull requests

6 participants