Skip to content

Unexpected result when using AND with INTEGER #7457

Description

@suyZhong

Describe the bug
Consider the test case below. It is unexpected that the third query returns 1 row, since the second query returns two rows of true, which means that the WHERE clause in the third query should be evaluated to true and thus return all the rows in the table.

To Reproduce

DROP TABLE IF EXISTS t0 CASCADE;

CREATE TABLE t0(c0 VARCHAR(500), c1 BOOLEAN);
INSERT INTO t0 (c0, c1) VALUES ('a', false);
INSERT INTO t0 (c0) VALUES ('b');

SELECT * FROM t0; -- a false, b null
SELECT (1 AND 3) FROM t0; -- true, true
SELECT * FROM t0 WHERE (1 AND 3);
-- Expected: a false, b null (2 rows)
-- Actual: a false  (1 row)

Expected behavior
As mentioned above

Screenshots
N/A

Software versions
Build from source:

> docker exec monetdb-test mserver5 --version --dbname=monetdb
MonetDB 5 server 11.50.0 (hg id: d74d3e6) (64-bit, 128-bit integers)
This is an unreleased version
Copyright (c) 1993 - July 2008 CWI
Copyright (c) August 2008 - 2023 MonetDB B.V., all rights reserved
Visit https://www.monetdb.org/ for further information
Found 503.5GiB available memory, 128 available cpu cores
Libraries:
Compiled by: @48d5e0fbdd97 (x86_64-pc-linux-gnu)
Compilation: /usr/bin/cc 
Linking    : /usr/bin/ld

Issue labeling
Bug

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions