summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/compat/oracle/t/func_time.test
blob: c1174f7f3952139d13caf2b1a04c3934410a9095 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
SET sql_mode=ORACLE;

--echo #
--echo # Start of 10.3 tests
--echo #

--echo #
--echo # MDEV-16152 Expressions with INTERVAL return bad results in some cases
--echo #

SELECT TIMESTAMP'2001-01-01 10:20:30' - INTERVAL '10' YEAR AS c1,
      -INTERVAL '10' YEAR + TIMESTAMP'2001-01-01 10:20:30' AS c2;

SELECT TIMESTAMP'2001-01-01 10:20:30' + INTERVAL '10' YEAR AS c1,
       INTERVAL '10' YEAR + TIMESTAMP'2001-01-01 10:20:30' AS c2,
      +INTERVAL '10' YEAR + TIMESTAMP'2001-01-01 10:20:30' AS c3;

EXPLAIN EXTENDED SELECT
  TIMESTAMP'2001-01-01 10:20:30' - INTERVAL '10' YEAR AS c1,
  -INTERVAL '10' YEAR + TIMESTAMP'2001-01-01 10:20:30' AS c2;

EXPLAIN EXTENDED SELECT
  TIMESTAMP'2001-01-01 10:20:30' + INTERVAL '10' YEAR AS c1,
  INTERVAL '10' YEAR + TIMESTAMP'2001-01-01 10:20:30' AS c2,
  +INTERVAL '10' YEAR + TIMESTAMP'2001-01-01 10:20:30' AS c3;