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

Binary operators appear too permissive with their types #3164

Closed
justinj opened this issue May 27, 2020 · 1 comment · Fixed by #3322
Closed

Binary operators appear too permissive with their types #3164

justinj opened this issue May 27, 2020 · 1 comment · Fixed by #3322
Assignees
Labels
C-bug Category: something is broken

Comments

@justinj
Copy link
Contributor

justinj commented May 27, 2020

materialize=> select 'foo'::string < 5::int;
 ?column?
----------
 f
(1 row)

vs.

postgres=# select 'foo'::text < 5::int;
ERROR:  operator does not exist: text < integer

@sploiselle tells me his ongoing work should eventually address this!

@justinj justinj added the C-bug Category: something is broken label May 27, 2020
@sploiselle
Copy link
Contributor

Found another instance of this:

The following two queries work in Materialize but fail in PG:

Query:

(VALUES (
    1 < ANY(SELECT * FROM (VALUES (1)) s WHERE false),
    1 < ANY(VALUES (0)),
    1 < ANY(VALUES (1)),
    1 < ANY(VALUES (2)),
    1 < ANY(VALUES (NULL)),
    1 < ANY(VALUES (0), (NULL)),
    1 < ANY(VALUES (1), (NULL)),
    1 < ANY(VALUES (2), (NULL)),
    NULL < ANY(SELECT * FROM (VALUES (1)) s WHERE false),
    NULL < ANY(VALUES (0)),
    NULL < ANY(VALUES (1)),
    NULL < ANY(VALUES (2)),
    NULL < ANY(VALUES (NULL)),
    NULL < ANY(VALUES (0), (NULL)),
    NULL < ANY(VALUES (1), (NULL)),
    NULL < ANY(VALUES (2), (NULL))
))

PG:

ERROR:  operator does not exist: integer < text
LINE 6:     1 < ANY(VALUES (NULL)),

MZ in test/sqllogictest/subquery.slt

 column1 | column2 | column3 | column4 | column5 | column6 | column7 | column8 | column9 | column10 | column11 | column12 | column13 | column14 | column15 | column16
---------+---------+---------+---------+---------+---------+---------+---------+---------+----------+----------+----------+----------+----------+----------+----------
 t       | f       | f       | t       |         | f       | f       |         |         |          |          |          |          |          |          |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants