[MDEV-15004] parser greedily parses AS OF TIMESTAMP Created: 2018-01-19  Updated: 2018-04-09  Resolved: 2018-02-22

Status: Closed
Project: MariaDB Server
Component/s: Versioned Tables
Affects Version/s: 10.3.4
Fix Version/s: 10.3.5

Type: Bug Priority: Critical
Reporter: Sergei Golubchik Assignee: Aleksey Midenkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-15818 Fix shift-reduce conflicts in the new... Closed

 Description   

In AS OF TIMESTAMP xxx, the TIMESTAMP is always parsed as a part of AS OF, even if it's actually a part of the expression (the complete expression being TIMESTAMP xxx).

Examples:

DATETIME literal

SELECT TIMESTAMP'2016-02-30 08:07:06';
→ ERROR 1525 (HY000): Incorrect DATETIME value: '2016-02-30 08:07:06'
SELECT * FROM t1 FOR SYSTEM_TIME AS OF TIMESTAMP'2016-02-30 08:07:06';
→ ok
SELECT * FROM t1 FOR SYSTEM_TIME AS OF (TIMESTAMP'2016-02-30 08:07:06');
→ ERROR 1525 (HY000): Incorrect DATETIME value: '2016-02-30 08:07:06'

two-argument TIMESTAMP() function

SELECT TIMESTAMP('2003-12-31 12:00:00','12:00:00');
→ ok
SELECT * FROM t1 FOR SYSTEM_TIME AS OF TIMESTAMP('2003-12-31 12:00:00','12:00:00')
→ ERROR 1241 (21000): Operand should contain 1 column(s)
SELECT * FROM t1 FOR SYSTEM_TIME AS OF (TIMESTAMP('2003-12-31 12:00:00','12:00:00'));
→ ok


Generated at Thu Feb 08 08:17:58 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.