Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Duplicate
-
12.2.2
-
None
-
12.2.2-MariaDB-ubu2404
-
Not for Release Notes
Description
There is an unexpected divergence in query results when comparing a GEOMETRY object (e.g., PolygonFromText(...)) with a string expression LEFT(c0, c1) directly in the WHERE clause, compared to evaluating the same comparison against a materialized column in a table created via CREATE TABLE ... AS SELECT (CTAS).
Specifically:
In the base table t0, comparing PolygonFromText(...) <= LEFT(c0, c1) evaluates to TRUE and returns 1 row.
In table t1 (created via CREATE TABLE t1 AS SELECT LEFT(c0, c1) AS c0 FROM t0
, comparing PolygonFromText(...) <= c0 evaluates to FALSE and returns Empty set.
How to repeat
DROP DATABASE IF EXISTS test;
CREATE DATABASE test;
USE test;
– Step 1: Create base table t0 and insert sample data
CREATE TABLE t0 (
c0 SMALLINT,
c1 FLOAT
);
INSERT INTO t0 VALUES (
3493,
7.955814907113371e+36
);
– Step 2: Create materialized table t1 via CTAS
CREATE TABLE t1 AS
SELECT LEFT(c0, c1) AS c0
FROM t0;
– Query 1: Dynamic evaluation on base table t0
SELECT LEFT(c0, c1)
FROM t0
WHERE PolygonFromText(
'POLYGON((
-113.784272 -75.368122,
-138.334937 67.313539,
-176.118115 78.731924,
171.609445 82.702657,
-113.784272 -75.368122
))'
) <= LEFT(c0, c1);
– Returns: 1 row ('3493')
– Query 2: Evaluation on materialized column in t1
SELECT c0
FROM t1
WHERE PolygonFromText(
'POLYGON((
-113.784272 -75.368122,
-138.334937 67.313539,
-176.118115 78.731924,
171.609445 82.702657,
-113.784272 -75.368122
))'
) <= c0;
– Returns: Empty set (0 rows)
Attachments
Issue Links
- duplicates
-
MDEV-40503 Inconsistent evaluation of ENUM comparison between dynamic CHAR() expression and CTAS materialized column
-
- Confirmed
-