Details
-
Bug
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
12.2.2
-
None
-
12.2.2-MariaDB-ubu2404
-
Not for Release Notes
Description
I found an inconsistency involving COERCIBILITY(), BIN(), VIEW/CTE expansion, and CREATE TEMPORARY TABLE AS SELECT.
The same BIN(c2) expression has different COERCIBILITY() results depending on whether it is evaluated through a VIEW, a CTE, or a TEMPORARY TABLE.
The VIEW and CTE versions return 6, while the TEMPORARY TABLE version returns 2.
How to repeat:
DROP VIEW IF EXISTS v0; |
DROP TEMPORARY TABLE IF EXISTS tmp; |
DROP TABLE IF EXISTS t0; |
|
|
CREATE TABLE t0 ( |
c2 BIGINT |
);
|
|
|
INSERT INTO t0 VALUES (100); |
|
|
CREATE VIEW v0 AS |
SELECT BIN(c2) AS vc |
FROM t0; |
|
|
SELECT COERCIBILITY(vc) |
FROM v0; |
|
|
WITH cte AS ( |
SELECT BIN(c2) AS vc |
FROM t0 |
)
|
SELECT COERCIBILITY(vc) |
FROM cte; |
|
|
CREATE TEMPORARY TABLE tmp AS |
SELECT BIN(c2) AS vc |
FROM t0; |
|
|
SELECT COERCIBILITY(vc) |
FROM tmp; |
Actual result:
The VIEW query returns:
+------------------+
|
| COERCIBILITY(vc) |
|
+------------------+
|
| 6 |
|
+------------------+
|
The CTE query returns:
+------------------+
|
| COERCIBILITY(vc) |
|
+------------------+
|
| 6 |
|
+------------------+
|
The TEMPORARY TABLE query returns:
+------------------+
|
| COERCIBILITY(vc) |
|
+------------------+
|
| 2 |
|
+------------------+
|
Expected result:
The VIEW, CTE, and TEMPORARY TABLE forms should have consistent coercibility metadata for the same selected expression, or the difference should be documented/expected.
Reason:
The expression is:
BIN(c2)
|
The same expression is exposed as column alias vc in a VIEW, a CTE, and a TEMPORARY TABLE.
However, COERCIBILITY(vc) returns 6 for VIEW/CTE and 2 for the TEMPORARY TABLE.
This suggests a possible inconsistency in expression metadata preservation, view/CTE expansion, or CREATE TEMPORARY TABLE AS SELECT materialization.