提交 f6fbfb09 编写于 作者: H Heikki Linnakangas

Move test for to_date() boundary checks out of TINC.

上级 1c3ccd5a
......@@ -680,6 +680,29 @@ order by a;
10 | 10
(10 rows)
-- ----------------------------------------------------------------------
-- Test: to_date() boundaries.
--
-- to_date() used to not check the input like the date input function
-- does. The fix was submitted to upstream PostgreSQL and fixed there in
-- version 8.4.16 (commit 5c4eb9166e.)
-- ----------------------------------------------------------------------
select to_date('-4713-11-23', 'yyyy-mm-dd');
ERROR: date out of range: "-4713-11-23"
select to_date('-4713-11-24', 'yyyy-mm-dd');
to_date
---------------
11-24-4714 BC
(1 row)
select to_date('5874897-12-31', 'yyyy-mm-dd');
to_date
---------------
12-31-5874897
(1 row)
select to_date('5874898-01-01', 'yyyy-mm-dd');
ERROR: date out of range: "5874898-01-01"
-- start_ignore
drop schema qp_misc_rio cascade;
NOTICE: drop cascades to table qp_misc_rio.ccdd1
......
......@@ -524,3 +524,16 @@ from
) sub1
group by a
order by a;
-- ----------------------------------------------------------------------
-- Test: to_date() boundaries.
--
-- to_date() used to not check the input like the date input function
-- does. The fix was submitted to upstream PostgreSQL and fixed there in
-- version 8.4.16 (commit 5c4eb9166e.)
-- ----------------------------------------------------------------------
select to_date('-4713-11-23', 'yyyy-mm-dd');
select to_date('-4713-11-24', 'yyyy-mm-dd');
select to_date('5874897-12-31', 'yyyy-mm-dd');
select to_date('5874898-01-01', 'yyyy-mm-dd');
-- start_ignore
SET optimizer=on;
SET
SET optimizer_log=on;
SET
-- end_ignore
-- @author xiongg1
-- @created 2015-01-20 12:00:00
-- @modified 2015-01-20 12:00:00
-- @tags dml ORCA
-- @product_version gpdb: [4.3.5.0-]
-- @description Tests for MPP-24621
select to_date('-4713-11-23', 'yyyy-mm-dd');
ERROR: date out of range: "-4713-11-23"
select to_date('-4713-11-24', 'yyyy-mm-dd');
to_date
---------------
4714-11-24 BC
(1 row)
select to_date('5874897-12-31', 'yyyy-mm-dd');
to_date
---------------
5874897-12-31
(1 row)
select to_date('5874898-01-01', 'yyyy-mm-dd');
ERROR: date out of range: "5874898-01-01"
-- start_ignore
drop table if exists t_to_date;
DROP TABLE
create table t_to_date(c1 date);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'c1' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
CREATE TABLE
-- end_ignore
insert into t_to_date values (to_date('-4713-11-24', 'yyyy-mm-dd'));
INSERT 0 1
insert into t_to_date values (to_date('5874897-12-31', 'yyyy-mm-dd'));
INSERT 0 1
select * from t_to_date;
c1
---------------
4714-11-24 BC
5874897-12-31
(2 rows)
-- @author xiongg1
-- @created 2015-01-20 12:00:00
-- @modified 2015-01-20 12:00:00
-- @tags dml ORCA
-- @product_version gpdb: [4.3.5.0-]
-- @description Tests for MPP-24621
select to_date('-4713-11-23', 'yyyy-mm-dd');
select to_date('-4713-11-24', 'yyyy-mm-dd');
select to_date('5874897-12-31', 'yyyy-mm-dd');
select to_date('5874898-01-01', 'yyyy-mm-dd');
-- start_ignore
drop table if exists t_to_date;
create table t_to_date(c1 date);
-- end_ignore
insert into t_to_date values (to_date('-4713-11-24', 'yyyy-mm-dd'));
insert into t_to_date values (to_date('5874897-12-31', 'yyyy-mm-dd'));
select * from t_to_date;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册