Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
N/A
-
None
-
Not for Release Notes
Description
When TO_DATE function with DEFAULT clause is used in a view definition, the resulting frm is missing a space between the first argument and the DEFAULT word.
|
bb-12.3-MDEV-19683-to_date 2b105f686c9b801d63cf9041093b9e2d24e0ae55 |
TYPE=VIEW |
query=select to_date(`test`.`t`.`a`DEFAULT \'2020-01-01\' ON CONVERSION ERROR,\'YYYY-MM-DD\') AS `x` from `test`.`t` |
Normally it doesn't cause a problem, as the column names or text literals are quoted, but in certain cases, e.g. if the argument is NULL or a numeric constant, it leads to further syntax errors:
CREATE OR REPLACE VIEW v AS SELECT TO_DATE(NULL DEFAULT '2020-01-01' ON CONVERSION ERROR, 'YYYY-MM-DD') AS x FROM t; |
...
|
TYPE=VIEW |
query=select to_date(NULLDEFAULT \'2020-01-01\' ON CONVERSION ERROR,\'YYYY-MM-DD\') AS `x` from `test`.`t` |
...
|
SELECT * FROM v' failed: ER_PARSE_ERROR (1064): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''2020-01-01' ON CONVERSION ERROR,'YYYY-MM-DD') AS `x` from `test`.`t` |
CREATE TABLE t (a INT); |
CREATE VIEW v AS SELECT TO_DATE(a DEFAULT '2020-01-01' ON CONVERSION ERROR, 'YYYY-MM-DD') AS x FROM t; |
--cat_file $MARIADB_DATADIR/test/v.frm
|
|
|
CREATE OR REPLACE VIEW v AS SELECT TO_DATE(NULL DEFAULT '2020-01-01' ON CONVERSION ERROR, 'YYYY-MM-DD') AS x FROM t; |
--cat_file $MARIADB_DATADIR/test/v.frm
|
SELECT * FROM v; |
|
|
DROP VIEW v; |
DROP TABLE t; |
Attachments
Issue Links
- is caused by
-
MDEV-19683 Add support for Oracle TO_DATE()
-
- In Testing
-