[MDEV-31672] Behavior of SELECT (CAST 'N/A' AS INT) varys depending on CTE + INSERT Created: 2023-07-12 Updated: 2023-07-12 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Data Manipulation - Insert |
| Affects Version/s: | 10.5.5 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | Daniel Challis | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows 10, 10.5.5-MariaDB, tested in HeidiSQL and also command line. |
||
| Description |
|
Please see steps to reproduce as follows.... CREATE TABLE `a` ( /* This fails correctly with an INT conversion error (1292) INSERT INTO A /* but this runs okay with the CAST changing 'N/A' to a 0, only when you attempt any INSERT do you get an error WITH CTE AS (SELECT CAST(LTRIM(RTRIM('N/A')) AS INT) AS someNumber WHERE CAST(LTRIM(RTRIM('N/A')) AS INT) = 0) DROP TABLE A; /* Which one is the preferred behavior? Can we get it consistent please! */ |