!830 修复升级问题

Merge pull request !830 from 邓旭玥/efix_upgrade_1.1.0_0317
This commit is contained in:
opengauss-bot 2021-03-19 17:57:23 +08:00 committed by Gitee
commit 1cbac06f20
31 changed files with 424 additions and 545 deletions

View File

@ -1850,9 +1850,6 @@ CREATE VIEW pg_user_mappings AS
REVOKE ALL on pg_user_mapping FROM public;
CREATE OR REPLACE VIEW PG_CATALOG.DUAL AS (SELECT 'X'::TEXT AS DUMMY);
GRANT SELECT ON TABLE DUAL TO PUBLIC;
-- these functions are added for supporting default format transformation
CREATE OR REPLACE FUNCTION to_char(NUMERIC)
RETURNS VARCHAR2

View File

@ -8781,8 +8781,7 @@ DECLARE
query_str_do_revoke text;
BEGIN
query_str_create_table := 'CREATE TABLE public.pgxc_copy_error_log
(relname varchar, begintime timestamptz, filename varchar, lineno int8, rawrecord text, detail text)
DISTRIBUTE BY hash(begintime)';
(relname varchar, begintime timestamptz, filename varchar, lineno int8, rawrecord text, detail text)';
EXECUTE query_str_create_table;
query_str_create_index := 'CREATE INDEX copy_error_log_relname_idx ON public.pgxc_copy_error_log(relname)';
@ -10759,67 +10758,7 @@ end;
$$language plpgsql NOT FENCED;
--Test distribute situation
create or replace function table_skewness(table_name text, column_name text,
OUT seqNum text, OUT Num text, OUT Ratio text, row_num text default '0')
RETURNS setof record
AS $$
DECLARE
tolal_num text;
row_data record;
execute_query text;
dist_type text;
num int :=0;
sqltmp text;
BEGIN
sqltmp := 'select count(*) from pg_attribute join pg_class on pg_attribute.attrelid = pg_class.oid where pg_class.relname =' || quote_literal(table_name) ||' and pg_attribute.attname = ' ||quote_literal($2);
EXECUTE immediate sqltmp into num;
if num = 0 then
return;
end if;
-- make sure not to affect the logic for non-range/list distribution tables
EXECUTE immediate 'select a.pclocatortype from (pgxc_class a join pg_class b on a.pcrelid = b.oid join pg_namespace c on c.oid = b.relnamespace)
where b.relname = quote_ident(:1) and c.nspname in (select unnest(current_schemas(false)))' into dist_type using table_name;
if dist_type <> 'G' and dist_type <> 'L' then
dist_type = 'H'; -- dist type used to be hardcoded as 'H'
end if;
if row_num = 0 then
EXECUTE 'select count(1) from ' || $1 into tolal_num;
execute_query = 'select seqNum, count(1) as num
from (select pg_catalog.table_data_skewness(row(' || $2 ||'), ''' || dist_type || ''') as seqNum from ' || $1 ||
') group by seqNum order by num DESC';
else
tolal_num = row_num;
execute_query = 'select seqNum, count(1) as num
from (select pg_catalog.table_data_skewness(row(' || $2 ||'), ''' || dist_type || ''') as seqNum from ' || $1 ||
' limit ' || row_num ||') group by seqNum order by num DESC';
end if;
if tolal_num = 0 then
seqNum = 0;
Num = 0;
Ratio = ROUND(0, 3) || '%';
return;
end if;
for row_data in EXECUTE execute_query loop
seqNum = row_data.seqNum;
Num = row_data.num;
Ratio = ROUND(row_data.num / tolal_num * 100, 3) || '%';
RETURN next;
end loop;
END;
$$LANGUAGE plpgsql NOT FENCED;
CREATE OR REPLACE FUNCTION report_application_error(
IN log text,
IN code integer default null
)RETURNS void
AS '$libdir/plpgsql','report_application_error'
LANGUAGE C VOLATILE NOT FENCED;
--Test distribute situation
create or replace function table_skewness(table_name text, column_name text,
create or replace function pg_catalog.table_skewness(table_name text, column_name text,
OUT seqNum text, OUT Num text, OUT Ratio text, row_num text default '0')
RETURNS setof record
AS $$
@ -11476,4 +11415,7 @@ SELECT
l.provider, l.label
FROM
pg_shseclabel l
JOIN pg_authid rol ON l.classoid = rol.tableoid AND l.objoid = rol.oid;
JOIN pg_authid rol ON l.classoid = rol.tableoid AND l.objoid = rol.oid;
CREATE OR REPLACE VIEW pg_catalog.gs_session_memory_context AS SELECT * FROM pv_session_memory_detail();
CREATE OR REPLACE VIEW pg_catalog.gs_thread_memory_context AS SELECT * FROM pv_thread_memory_detail();

View File

@ -2344,7 +2344,7 @@ WHERE totalsize > 0;
GRANT SELECT ON TABLE pg_catalog.pgxc_get_table_skewness TO PUBLIC;
create or replace function table_skewness(table_name text, column_name text,
create or replace function pg_catalog.table_skewness(table_name text, column_name text,
OUT seqNum text, OUT Num text, OUT Ratio text, row_num text default '0')
RETURNS setof record
AS $$

View File

@ -8781,8 +8781,7 @@ DECLARE
query_str_do_revoke text;
BEGIN
query_str_create_table := 'CREATE TABLE public.pgxc_copy_error_log
(relname varchar, begintime timestamptz, filename varchar, lineno int8, rawrecord text, detail text)
DISTRIBUTE BY hash(begintime)';
(relname varchar, begintime timestamptz, filename varchar, lineno int8, rawrecord text, detail text)';
EXECUTE query_str_create_table;
query_str_create_index := 'CREATE INDEX copy_error_log_relname_idx ON public.pgxc_copy_error_log(relname)';
@ -10759,67 +10758,7 @@ end;
$$language plpgsql NOT FENCED;
--Test distribute situation
create or replace function table_skewness(table_name text, column_name text,
OUT seqNum text, OUT Num text, OUT Ratio text, row_num text default '0')
RETURNS setof record
AS $$
DECLARE
tolal_num text;
row_data record;
execute_query text;
dist_type text;
num int :=0;
sqltmp text;
BEGIN
sqltmp := 'select count(*) from pg_attribute join pg_class on pg_attribute.attrelid = pg_class.oid where pg_class.relname =' || quote_literal(table_name) ||' and pg_attribute.attname = ' ||quote_literal($2);
EXECUTE immediate sqltmp into num;
if num = 0 then
return;
end if;
-- make sure not to affect the logic for non-range/list distribution tables
EXECUTE immediate 'select a.pclocatortype from (pgxc_class a join pg_class b on a.pcrelid = b.oid join pg_namespace c on c.oid = b.relnamespace)
where b.relname = quote_ident(:1) and c.nspname in (select unnest(current_schemas(false)))' into dist_type using table_name;
if dist_type <> 'G' and dist_type <> 'L' then
dist_type = 'H'; -- dist type used to be hardcoded as 'H'
end if;
if row_num = 0 then
EXECUTE 'select count(1) from ' || $1 into tolal_num;
execute_query = 'select seqNum, count(1) as num
from (select pg_catalog.table_data_skewness(row(' || $2 ||'), ''' || dist_type || ''') as seqNum from ' || $1 ||
') group by seqNum order by num DESC';
else
tolal_num = row_num;
execute_query = 'select seqNum, count(1) as num
from (select pg_catalog.table_data_skewness(row(' || $2 ||'), ''' || dist_type || ''') as seqNum from ' || $1 ||
' limit ' || row_num ||') group by seqNum order by num DESC';
end if;
if tolal_num = 0 then
seqNum = 0;
Num = 0;
Ratio = ROUND(0, 3) || '%';
return;
end if;
for row_data in EXECUTE execute_query loop
seqNum = row_data.seqNum;
Num = row_data.num;
Ratio = ROUND(row_data.num / tolal_num * 100, 3) || '%';
RETURN next;
end loop;
END;
$$LANGUAGE plpgsql NOT FENCED;
CREATE OR REPLACE FUNCTION report_application_error(
IN log text,
IN code integer default null
)RETURNS void
AS '$libdir/plpgsql','report_application_error'
LANGUAGE C VOLATILE NOT FENCED;
--Test distribute situation
create or replace function table_skewness(table_name text, column_name text,
create or replace function pg_catalog.table_skewness(table_name text, column_name text,
OUT seqNum text, OUT Num text, OUT Ratio text, row_num text default '0')
RETURNS setof record
AS $$
@ -11476,4 +11415,7 @@ SELECT
l.provider, l.label
FROM
pg_shseclabel l
JOIN pg_authid rol ON l.classoid = rol.tableoid AND l.objoid = rol.oid;
JOIN pg_authid rol ON l.classoid = rol.tableoid AND l.objoid = rol.oid;
CREATE OR REPLACE VIEW pg_catalog.gs_session_memory_context AS SELECT * FROM pv_session_memory_detail();
CREATE OR REPLACE VIEW pg_catalog.gs_thread_memory_context AS SELECT * FROM pv_thread_memory_detail();

View File

@ -2379,7 +2379,7 @@ WHERE totalsize > 0;
GRANT SELECT ON TABLE pg_catalog.pgxc_get_table_skewness TO PUBLIC;
create or replace function table_skewness(table_name text, column_name text,
create or replace function pg_catalog.table_skewness(table_name text, column_name text,
OUT seqNum text, OUT Num text, OUT Ratio text, row_num text default '0')
RETURNS setof record
AS $$

View File

@ -230,7 +230,7 @@ b varchar;
sql_srt varchar(100);
cursor c1 is select c1,c2 from cursor_vl_tb10 order by 1,2;
begin
sql_srt :='insert into cursor_vl_tb10(c1,c2) select :1,:1+1 from dual;';
sql_srt :='insert into cursor_vl_tb10(c1,c2) select :1,:1+1;';
while a1 > 0 loop
execute immediate sql_srt using IN a1;
a1:=a1-1;

View File

@ -336,7 +336,7 @@ BEGIN
raise info'TEST CHAR VALUE IS %',tempdata;
END;
$$ LANGUAGE plpgsql;
select TEST_FUNC('abc'::clob) from dual;
select TEST_FUNC('abc'::clob);
INFO: TEST CHAR VALUE IS abc
CONTEXT: referenced column: test_func
test_func
@ -344,7 +344,7 @@ CONTEXT: referenced column: test_func
(1 row)
select TEST_FUNC('abc'::varchar2) from dual;
select TEST_FUNC('abc'::varchar2);
INFO: TEST CHAR VALUE IS abc
CONTEXT: referenced column: test_func
test_func
@ -359,7 +359,7 @@ BEGIN
raise info'TEST VARCHAR VALUE IS %',tempdata;
END;
$$ LANGUAGE plpgsql;
select TEST_FUNC('abc'::clob) from dual;
select TEST_FUNC('abc'::clob);
INFO: TEST VARCHAR VALUE IS abc
CONTEXT: referenced column: test_func
test_func
@ -367,7 +367,7 @@ CONTEXT: referenced column: test_func
(1 row)
select TEST_FUNC(123) from dual;
select TEST_FUNC(123);
INFO: TEST VARCHAR VALUE IS 123
CONTEXT: referenced column: test_func
test_func
@ -375,7 +375,7 @@ CONTEXT: referenced column: test_func
(1 row)
select TEST_FUNC('123'::integer) from dual;
select TEST_FUNC('123'::integer);
INFO: TEST VARCHAR VALUE IS 123
CONTEXT: referenced column: test_func
test_func
@ -383,7 +383,7 @@ CONTEXT: referenced column: test_func
(1 row)
select TEST_FUNC('abc'::raw) from dual;
select TEST_FUNC('abc'::raw);
INFO: TEST VARCHAR VALUE IS 0ABC
CONTEXT: referenced column: test_func
test_func
@ -391,7 +391,7 @@ CONTEXT: referenced column: test_func
(1 row)
select TEST_FUNC('abc'::char) from dual;
select TEST_FUNC('abc'::char);
INFO: TEST VARCHAR VALUE IS a
CONTEXT: referenced column: test_func
test_func
@ -399,7 +399,7 @@ CONTEXT: referenced column: test_func
(1 row)
select TEST_FUNC('2012-08-01 11:23:45'::timestamp) from dual; --with timezone?
select TEST_FUNC('2012-08-01 11:23:45'::timestamp); --with timezone?
INFO: TEST VARCHAR VALUE IS 2012-08-01 11:23:45
CONTEXT: referenced column: test_func
test_func
@ -407,7 +407,7 @@ CONTEXT: referenced column: test_func
(1 row)
select TEST_FUNC(interval '1 18:00:00' day to second) from dual;
select TEST_FUNC(interval '1 18:00:00' day to second);
INFO: TEST VARCHAR VALUE IS @ 1 day 18 hours
CONTEXT: referenced column: test_func
test_func
@ -415,7 +415,7 @@ CONTEXT: referenced column: test_func
(1 row)
select TEST_FUNC('1 day 18:00:00') from dual;
select TEST_FUNC('1 day 18:00:00');
INFO: TEST VARCHAR VALUE IS 1 day 18:00:00
CONTEXT: referenced column: test_func
test_func
@ -430,7 +430,7 @@ BEGIN
raise info'TEST CLOB VALUE IS %',tempdata;
END;
$$ LANGUAGE plpgsql;
select TEST_FUNC('abc'::char) from dual;
select TEST_FUNC('abc'::char);
INFO: TEST CLOB VALUE IS a
CONTEXT: referenced column: test_func
test_func
@ -438,7 +438,7 @@ CONTEXT: referenced column: test_func
(1 row)
select TEST_FUNC('abc'::varchar2) from dual;
select TEST_FUNC('abc'::varchar2);
INFO: TEST CLOB VALUE IS abc
CONTEXT: referenced column: test_func
test_func
@ -453,7 +453,7 @@ BEGIN
raise info'TEST INTEGER VALUE IS %',tempdata;
END;
$$ LANGUAGE plpgsql;
select TEST_FUNC('123'::char(3)) from dual;
select TEST_FUNC('123'::char(3));
INFO: TEST INTEGER VALUE IS 123
CONTEXT: referenced column: test_func
test_func
@ -461,7 +461,7 @@ CONTEXT: referenced column: test_func
(1 row)
select TEST_FUNC('123'::varchar2) from dual;
select TEST_FUNC('123'::varchar2);
INFO: TEST INTEGER VALUE IS 123
CONTEXT: referenced column: test_func
test_func
@ -476,7 +476,7 @@ BEGIN
raise info'TEST TIMESTAMP VALUE IS %',tempdata;
END;
$$ LANGUAGE plpgsql;
select TEST_FUNC('2012-08-01 11:23:45'::char(20)) from dual;
select TEST_FUNC('2012-08-01 11:23:45'::char(20));
INFO: TEST TIMESTAMP VALUE IS 2012-08-01 11:23:45
CONTEXT: referenced column: test_func
test_func
@ -484,7 +484,7 @@ CONTEXT: referenced column: test_func
(1 row)
select TEST_FUNC('2012-08-01 11:23:45'::varchar2) from dual;
select TEST_FUNC('2012-08-01 11:23:45'::varchar2);
INFO: TEST TIMESTAMP VALUE IS 2012-08-01 11:23:45
CONTEXT: referenced column: test_func
test_func
@ -499,7 +499,7 @@ BEGIN
raise info'TEST INTERVAL VALUE IS %',tempdata;
END;
$$ LANGUAGE plpgsql;
select TEST_FUNC('1 day 18:00:00'::char(20)) from dual;
select TEST_FUNC('1 day 18:00:00'::char(20));
INFO: TEST INTERVAL VALUE IS @ 1 day 18 hours
CONTEXT: referenced column: test_func
test_func
@ -507,7 +507,7 @@ CONTEXT: referenced column: test_func
(1 row)
select TEST_FUNC('1 day 18:00:00'::varchar2) from dual;
select TEST_FUNC('1 day 18:00:00'::varchar2);
INFO: TEST INTERVAL VALUE IS @ 1 day 18 hours
CONTEXT: referenced column: test_func
test_func
@ -2010,28 +2010,28 @@ select 2 > '15'::text;
SELECT pg_catalog.array_dims(' '::anyarray) AS a
,LENGTH(pg_catalog.array_dims(' '::anyarray)) AS b
FROM dual;
;
ERROR: array value must start with "{" or dimension information
LINE 1: SELECT pg_catalog.array_dims(' '::anyarray) AS a
^
CONTEXT: referenced column: a
SELECT pg_catalog.array_to_string(' '::anyarray,' '::text) AS a
,LENGTH(pg_catalog.array_to_string(' '::anyarray,' '::text)) AS b
FROM dual;
;
ERROR: array value must start with "{" or dimension information
LINE 1: SELECT pg_catalog.array_to_string(' '::anyarray,' '::text) A...
^
CONTEXT: referenced column: a
SELECT pg_catalog.array_to_string(' '::anyarray,' '::text,''::text) AS a
,LENGTH(pg_catalog.array_to_string(' '::anyarray,' '::text,' '::text)) AS b
FROM dual;
;
ERROR: array value must start with "{" or dimension information
LINE 1: SELECT pg_catalog.array_to_string(' '::anyarray,' '::text,''...
^
CONTEXT: referenced column: a
SELECT pg_catalog.array_dims('{1,2,3}'::anyarray) AS a
,LENGTH(pg_catalog.array_dims('{1,2,3}'::anyarray)) AS b
FROM dual;
;
ERROR: array value must start with "{" or dimension information
LINE 1: SELECT pg_catalog.array_dims('{1,2,3}'::anyarray) AS a
^

View File

@ -853,7 +853,7 @@ HINT: Perhaps you need a different "datestyle" setting.
drop table date_smalldate;
--INTERAL TO NUMERIC
create table test_num(mynum numeric);
select to_date('2013-03-14 14:27:00','YYYY-MM-DD HH24:MI:SS') - to_date('2013-3-1 9:00:00','YYYY-MM-DD HH24:MI:SS') from dual;
select to_date('2013-03-14 14:27:00','YYYY-MM-DD HH24:MI:SS') - to_date('2013-3-1 9:00:00','YYYY-MM-DD HH24:MI:SS');
?column?
---------------------------
@ 13 days 5 hours 27 mins
@ -882,7 +882,7 @@ select floor(mynum) from test_num order by 1;
(2 rows)
drop table test_num;
select floor(interval '2 days 09:33:00') from dual;
select floor(interval '2 days 09:33:00');
floor
-------
2

View File

@ -28,8 +28,8 @@ select * from test_tb where name is null;
(1 row)
drop table test_tb;
-- select * from ( select 'NULL' from dual);
select * from ( select 'NULL' from dual) as a;
-- select * from ( select 'NULL');
select * from ( select 'NULL') as a;
?column?
----------
NULL
@ -89,49 +89,49 @@ select ltrim('abc', 'a') is not null;
/* The following case depence on nvl which is added by GuassDB */
/* expect is null */
select nvl(ltrim(NULL), 'is null') from dual;
select nvl(ltrim(NULL), 'is null');
nvl
---------
is null
(1 row)
select nvl(ltrim(''), 'is null') from dual;
select nvl(ltrim(''), 'is null');
nvl
---------
is null
(1 row)
select nvl(ltrim('', 'ab'), 'is null') from dual;
select nvl(ltrim('', 'ab'), 'is null');
nvl
---------
is null
(1 row)
select nvl(ltrim(NULL, 'ab'), 'is null') from dual;
select nvl(ltrim(NULL, 'ab'), 'is null');
nvl
---------
is null
(1 row)
select nvl(ltrim('ab', ''), 'is null') from dual;
select nvl(ltrim('ab', ''), 'is null');
nvl
---------
is null
(1 row)
select nvl(ltrim('ab', NULL), 'is null') from dual;
select nvl(ltrim('ab', NULL), 'is null');
nvl
---------
is null
(1 row)
select nvl(ltrim('ab', 'ab'), 'is null') from dual;
select nvl(ltrim('ab', 'ab'), 'is null');
nvl
---------
is null
(1 row)
select nvl(ltrim('abc', 'a'), 'is not null') from dual; -- return bc
select nvl(ltrim('abc', 'a'), 'is not null'); -- return bc
nvl
-----
bc
@ -445,13 +445,13 @@ select * from test_table where regexp_like(name, NULL, 'i'); -- return null
(0 rows)
drop table test_table;
select nvl(regexp_substr('This is test',''), 'This is NULL') from dual; -- return This is NULL
select nvl(regexp_substr('This is test',''), 'This is NULL'); -- return This is NULL
nvl
--------------
This is NULL
(1 row)
select nvl(regexp_substr('This is test',NULL), 'This is NULL') from dual; -- return This is NULL
select nvl(regexp_substr('This is test',NULL), 'This is NULL'); -- return This is NULL
nvl
--------------
This is NULL

View File

@ -9,7 +9,7 @@ AS
RETURN;
END;
/
SELECT test_return(1) from dual;
SELECT test_return(1);
test_return
-------------
2
@ -48,7 +48,7 @@ AS
RETURN j;
END;
/
SELECT test_return1(1) from dual;
SELECT test_return1(1);
test_return1
--------------
2
@ -123,7 +123,7 @@ AS
RETURN 'abc';
END;
/
SELECT test_return5(1) from dual;
SELECT test_return5(1);
test_return5
--------------
abc
@ -610,7 +610,7 @@ AS
RETURN;
END;
/
SELECT test_return(1) from dual;
SELECT test_return(1);
test_return
-------------
2
@ -649,7 +649,7 @@ AS
RETURN j;
END;
/
SELECT test_return1(1) from dual;
SELECT test_return1(1);
test_return1
--------------
2
@ -724,7 +724,7 @@ AS
RETURN 'abc';
END;
/
SELECT test_return5(1) from dual;
SELECT test_return5(1);
test_return5
--------------
abc

View File

@ -71,7 +71,7 @@ returns integer
language plpgsql
as $$ declare
begin
create temp table test_create_tmp as (select sysdate as s from dual);
create temp table test_create_tmp as (select sysdate as s);
ret :=0;
end $$
;
@ -174,12 +174,12 @@ returns integer
language plpgsql
as $$ declare
begin
create temp table test_create_tmp as (select sysdate as s from dual);
create temp table test_create_tmp as (select sysdate as s);
ret :=0;
insert into test_create_tmp_no_exit values (2);
exception
when others then
create temp table test_create_tmp as (select sysdate as s from dual);
create temp table test_create_tmp as (select sysdate as s);
ret :=1;
end $$
;

View File

@ -238,61 +238,61 @@ select numtodsinterval(-.1500321234,'second');
(1 row)
--boundary test
SELECT numtodsinterval(-2147483648, 'DAY')from dual;
SELECT numtodsinterval(-2147483648, 'DAY');
numtodsinterval
---------------------------------
--2147483648 00:00:00.000000000
(1 row)
SELECT numtodsinterval(-2147483648, 'HOUR')from dual;
SELECT numtodsinterval(-2147483648, 'HOUR');
numtodsinterval
-------------------------------
-089478485 08:00:00.000000000
(1 row)
SELECT numtodsinterval(-2147483648, 'MINUTE')from dual;
SELECT numtodsinterval(-2147483648, 'MINUTE');
numtodsinterval
-------------------------------
-001491308 02:08:00.000000000
(1 row)
SELECT numtodsinterval(-2147483648, 'SECOND')from dual;
SELECT numtodsinterval(-2147483648, 'SECOND');
numtodsinterval
-------------------------------
-000024855 03:14:08.000000000
(1 row)
SELECT numtodsinterval(2147483647, 'DAY')from dual;
SELECT numtodsinterval(2147483647, 'DAY');
numtodsinterval
--------------------------------
+2147483647 00:00:00.000000000
(1 row)
SELECT numtodsinterval(999999999.99999999999, 'DAY')from dual;
SELECT numtodsinterval(999999999.99999999999, 'DAY');
numtodsinterval
-------------------------------
+999999999 23:59:59.999999000
(1 row)
SELECT numtodsinterval(2147483647, 'HOUR')from dual;
SELECT numtodsinterval(2147483647, 'HOUR');
numtodsinterval
-------------------------------
+089478485 07:00:00.000000000
(1 row)
SELECT numtodsinterval(2147483647, 'MINUTE')from dual;
SELECT numtodsinterval(2147483647, 'MINUTE');
numtodsinterval
-------------------------------
+001491308 02:07:00.000000000
(1 row)
SELECT numtodsinterval(2147483647, 'SECOND')from dual;
SELECT numtodsinterval(2147483647, 'SECOND');
numtodsinterval
-------------------------------
+000024855 03:14:07.000000000
(1 row)
SELECT numtodsinterval(123456789.123456789, 'DAY')from dual;
SELECT numtodsinterval(123456789.123456789, 'DAY');
numtodsinterval
-------------------------------
+123456789 02:57:46.666570000

View File

@ -2671,7 +2671,7 @@ explain (format JSON) select a, b, c from vec_t1 group by rollup(a, b, c);
explain (format YAML) select a, b, c from vec_t1 group by rollup(a, b, c);
\o
drop table vec_t1;
select 1 a,2,count(*) from dual group by cube(1,2) having count(*)=1 order by 1, 2;
select 1 a,2,count(*) group by cube(1,2) having count(*)=1 order by 1, 2;
a | ?column? | count
---+----------+-------
1 | 2 | 1

View File

@ -149,482 +149,482 @@ CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('366-4','YYYY-DD-12');
ERROR: invalid data for match in format string
CONTEXT: referenced column: to_timestamp
select to_timestamp('-4713','YYYY') from dual;
select to_timestamp('-4713','YYYY');
ERROR: invalid data for "year = -4713" ,value must be between 1 and 9999, and not be 0
CONTEXT: referenced column: to_timestamp
select to_timestamp('-4712','YYYY') from dual;
select to_timestamp('-4712','YYYY');
ERROR: invalid data for "year = -4712" ,value must be between 1 and 9999, and not be 0
CONTEXT: referenced column: to_timestamp
select to_timestamp('-1','YYYY') from dual;
select to_timestamp('-1','YYYY');
ERROR: invalid data for "year = -1" ,value must be between 1 and 9999, and not be 0
CONTEXT: referenced column: to_timestamp
select to_timestamp('0','YYYY') from dual;
select to_timestamp('0','YYYY');
ERROR: invalid data for "year = 0" ,value must be between 1 and 9999, and not be 0
CONTEXT: referenced column: to_timestamp
select to_timestamp('1','YYYY') from dual;
select to_timestamp('1','YYYY');
to_timestamp
---------------------
0001-01-01 00:00:00
(1 row)
select to_timestamp('9999','YYYY') from dual;
select to_timestamp('9999','YYYY');
to_timestamp
---------------------
9999-01-01 00:00:00
(1 row)
select to_timestamp('10000','YYYY') from dual;
select to_timestamp('10000','YYYY');
ERROR: invalid data for "year = 10000" ,value must be between 1 and 9999, and not be 0
CONTEXT: referenced column: to_timestamp
select to_timestamp('10','H24') from dual;
select to_timestamp('10','H24');
ERROR: invalid data for match in format string
CONTEXT: referenced column: to_timestamp
select to_timestamp('10','H24') from dual;
select to_timestamp('10','H24');
ERROR: invalid data for match in format string
CONTEXT: referenced column: to_timestamp
SELECT to_timestamp('-2012-2/3,21.15;36:18','YYYY-MM/DD,HH24.MI;SS:FF') FROM DUAL;
SELECT to_timestamp('-2012-2/3,21.15;36:18','YYYY-MM/DD,HH24.MI;SS:FF');
ERROR: invalid data for "year = -2012" ,value must be between 1 and 9999, and not be 0
CONTEXT: referenced column: to_timestamp
SELECT to_timestamp('-1-2/3,21.15;36:18','YYYY-MM/DD,HH24.MI;SS:FF') FROM DUAL;
SELECT to_timestamp('-1-2/3,21.15;36:18','YYYY-MM/DD,HH24.MI;SS:FF');
ERROR: invalid data for "year = -1" ,value must be between 1 and 9999, and not be 0
CONTEXT: referenced column: to_timestamp
SELECT to_timestamp('0-2/3,21.15;36:18','YYYY-MM/DD,HH24.MI;SS:FF') FROM DUAL;
SELECT to_timestamp('0-2/3,21.15;36:18','YYYY-MM/DD,HH24.MI;SS:FF');
ERROR: invalid data for "year = 0" ,value must be between 1 and 9999, and not be 0
CONTEXT: referenced column: to_timestamp
SELECT to_timestamp('9999-2/3,21.15;36:18','YYYY-MM/DD,HH24.MI;SS:FF') FROM DUAL;
SELECT to_timestamp('9999-2/3,21.15;36:18','YYYY-MM/DD,HH24.MI;SS:FF');
to_timestamp
------------------------
9999-02-03 21:15:36.18
(1 row)
SELECT to_timestamp('10000-2/3,21.15;36:18','YYYY-MM/DD,HH24.MI;SS:FF') FROM DUAL;
SELECT to_timestamp('10000-2/3,21.15;36:18','YYYY-MM/DD,HH24.MI;SS:FF');
ERROR: invalid data for "year = 10000" ,value must be between 1 and 9999, and not be 0
CONTEXT: referenced column: to_timestamp
select to_timestamp('-4713-3-4 13:2:3.234015', 'syyyy-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-4713-3-4 13:2:3.234015', 'syyyy-mm-dd hh24:mi:ss.ff');
ERROR: invalid data for "year = -4713" ,value must be between -4712 and 9999, and not be 0
CONTEXT: referenced column: to_timestamp
select to_timestamp('-4712-3-4 13:2:3.234015', 'syyyy-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-4712-3-4 13:2:3.234015', 'syyyy-mm-dd hh24:mi:ss.ff');
to_timestamp
-------------------------------
4712-03-04 13:02:03.234015 BC
(1 row)
select to_timestamp('0-3-4 13:2:3.234015', 'syyyy-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('0-3-4 13:2:3.234015', 'syyyy-mm-dd hh24:mi:ss.ff');
ERROR: invalid data for "year = 0" ,value must be between -4712 and 9999, and not be 0
CONTEXT: referenced column: to_timestamp
select to_timestamp('9999-3-4 13:2:3.234015', 'syyyy-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('9999-3-4 13:2:3.234015', 'syyyy-mm-dd hh24:mi:ss.ff');
to_timestamp
----------------------------
9999-03-04 13:02:03.234015
(1 row)
select to_timestamp('10000-3-4 13:2:3.234015', 'syyyy-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('10000-3-4 13:2:3.234015', 'syyyy-mm-dd hh24:mi:ss.ff');
ERROR: invalid data for "year = 10000" ,value must be between -4712 and 9999, and not be 0
CONTEXT: referenced column: to_timestamp
select to_timestamp('-4713-3-4 13:2:3.234015', 'SYYYY-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-4713-3-4 13:2:3.234015', 'SYYYY-mm-dd hh24:mi:ss.ff');
ERROR: invalid data for "year = -4713" ,value must be between -4712 and 9999, and not be 0
CONTEXT: referenced column: to_timestamp
select to_timestamp('-4712-3-4 13:2:3.234015', 'SYYYY-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-4712-3-4 13:2:3.234015', 'SYYYY-mm-dd hh24:mi:ss.ff');
to_timestamp
-------------------------------
4712-03-04 13:02:03.234015 BC
(1 row)
select to_timestamp('0-3-4 13:2:3.234015', 'SYYYY-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('0-3-4 13:2:3.234015', 'SYYYY-mm-dd hh24:mi:ss.ff');
ERROR: invalid data for "year = 0" ,value must be between -4712 and 9999, and not be 0
CONTEXT: referenced column: to_timestamp
select to_timestamp('9999-3-4 13:2:3.234015', 'SYYYY-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('9999-3-4 13:2:3.234015', 'SYYYY-mm-dd hh24:mi:ss.ff');
to_timestamp
----------------------------
9999-03-04 13:02:03.234015
(1 row)
select to_timestamp('10000-3-4 13:2:3.234015', 'SYYYY-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('10000-3-4 13:2:3.234015', 'SYYYY-mm-dd hh24:mi:ss.ff');
ERROR: invalid data for "year = 10000" ,value must be between -4712 and 9999, and not be 0
CONTEXT: referenced column: to_timestamp
select to_timestamp('-4713-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-4713-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff');
ERROR: invalid data for "year(RR/RRRR) = -4713" ,value must be between 0 and 9999
CONTEXT: referenced column: to_timestamp
select to_timestamp('-4712-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-4712-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff');
ERROR: invalid data for "year(RR/RRRR) = -4712" ,value must be between 0 and 9999
CONTEXT: referenced column: to_timestamp
select to_timestamp('-1-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-1-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff');
ERROR: RR/RRRR should be between 0 - 9999
CONTEXT: referenced column: to_timestamp
select to_timestamp('0-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('0-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff');
to_timestamp
----------------------------
2000-03-04 13:02:03.234015
(1 row)
select to_timestamp('1-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('1-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff');
to_timestamp
----------------------------
2001-03-04 13:02:03.234015
(1 row)
select to_timestamp('9999-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('9999-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff');
to_timestamp
----------------------------
9999-03-04 13:02:03.234015
(1 row)
select to_timestamp('10000-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('10000-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff');
ERROR: invalid data for "year(RR/RRRR) = 10000" ,value must be between 0 and 9999
CONTEXT: referenced column: to_timestamp
select to_timestamp('-4713-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-4713-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff');
ERROR: invalid data for "year(RR/RRRR) = -4713" ,value must be between 0 and 9999
CONTEXT: referenced column: to_timestamp
select to_timestamp('-4712-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-4712-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff');
ERROR: invalid data for "year(RR/RRRR) = -4712" ,value must be between 0 and 9999
CONTEXT: referenced column: to_timestamp
select to_timestamp('-1-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-1-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff');
ERROR: RR/RRRR should be between 0 - 9999
CONTEXT: referenced column: to_timestamp
select to_timestamp('0-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('0-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff');
to_timestamp
----------------------------
2000-03-04 13:02:03.234015
(1 row)
select to_timestamp('1-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('1-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff');
to_timestamp
----------------------------
2001-03-04 13:02:03.234015
(1 row)
select to_timestamp('9999-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('9999-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff');
to_timestamp
----------------------------
9999-03-04 13:02:03.234015
(1 row)
select to_timestamp('10000-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('10000-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff');
ERROR: invalid data for "year(RR/RRRR) = 10000" ,value must be between 0 and 9999
CONTEXT: referenced column: to_timestamp
select to_timestamp('-4713-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-4713-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff');
ERROR: invalid data for "year(RR/RRRR) = -4713" ,value must be between 0 and 9999
CONTEXT: referenced column: to_timestamp
select to_timestamp('-4712-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-4712-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff');
ERROR: invalid data for "year(RR/RRRR) = -4712" ,value must be between 0 and 9999
CONTEXT: referenced column: to_timestamp
select to_timestamp('-1-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-1-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff');
ERROR: RR/RRRR should be between 0 - 9999
CONTEXT: referenced column: to_timestamp
select to_timestamp('0-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('0-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff');
to_timestamp
----------------------------
2000-03-04 13:02:03.234015
(1 row)
select to_timestamp('1-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('1-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff');
to_timestamp
----------------------------
2001-03-04 13:02:03.234015
(1 row)
select to_timestamp('9999-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('9999-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff');
to_timestamp
----------------------------
9999-03-04 13:02:03.234015
(1 row)
select to_timestamp('10000-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('10000-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff');
ERROR: invalid data for "year(RR/RRRR) = 10000" ,value must be between 0 and 9999
CONTEXT: referenced column: to_timestamp
select to_timestamp('-4713-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-4713-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff');
ERROR: invalid data for "year(RR/RRRR) = -4713" ,value must be between 0 and 9999
CONTEXT: referenced column: to_timestamp
select to_timestamp('-4712-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-4712-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff');
ERROR: invalid data for "year(RR/RRRR) = -4712" ,value must be between 0 and 9999
CONTEXT: referenced column: to_timestamp
select to_timestamp('-1-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-1-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff');
ERROR: RR/RRRR should be between 0 - 9999
CONTEXT: referenced column: to_timestamp
select to_timestamp('0-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('0-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff');
to_timestamp
----------------------------
2000-03-04 13:02:03.234015
(1 row)
select to_timestamp('1-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('1-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff');
to_timestamp
----------------------------
2001-03-04 13:02:03.234015
(1 row)
select to_timestamp('9999-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('9999-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff');
to_timestamp
----------------------------
9999-03-04 13:02:03.234015
(1 row)
select to_timestamp('10000-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('10000-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff');
ERROR: invalid data for "year(RR/RRRR) = 10000" ,value must be between 0 and 9999
CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('0000-09-01','YYYYY-MM-DD') FROM DUAL;
SELECT TO_TIMESTAMP('0000-09-01','YYYYY-MM-DD');
ERROR: conflicting values for "Y" field in formatting string
DETAIL: This value contradicts a previous setting for the same field type.
CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('0000-09-01','SYYYYY-MM-DD') FROM DUAL;
SELECT TO_TIMESTAMP('0000-09-01','SYYYYY-MM-DD');
ERROR: invalid value "0000-" for "SYYYY"
DETAIL: Field requires 5 characters, but only 4 could be parsed.
HINT: If your source string is not fixed-width, try using the "FM" modifier.
CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('0000-09-01','SYYYY-Y-MM-DD') FROM DUAL;
SELECT TO_TIMESTAMP('0000-09-01','SYYYY-Y-MM-DD');
ERROR: conflicting values for "Y" field in formatting string
DETAIL: This value contradicts a previous setting for the same field type.
CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('25361','SSSSS') FROM DUAL;
SELECT TO_TIMESTAMP('25361','SSSSS');
to_timestamp
------------------------
0001-01-01 07:02:41 BC
(1 row)
SELECT TO_TIMESTAMP('25361-2','SSSSS-HH12') FROM DUAL;
SELECT TO_TIMESTAMP('25361-2','SSSSS-HH12');
ERROR: hour conflicts with seconds in day
CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('25361-07','SSSSS-HH12') FROM DUAL;
SELECT TO_TIMESTAMP('25361-07','SSSSS-HH12');
to_timestamp
------------------------
0001-01-01 07:02:41 BC
(1 row)
SELECT TO_TIMESTAMP('25361-2','SSSSS-MI') FROM DUAL;
SELECT TO_TIMESTAMP('25361-2','SSSSS-MI');
to_timestamp
------------------------
0001-01-01 07:02:41 BC
(1 row)
SELECT TO_TIMESTAMP('25361-10','SSSSS-MI') FROM DUAL;
SELECT TO_TIMESTAMP('25361-10','SSSSS-MI');
ERROR: minutes of hour conflicts with seconds in day
CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('25361-2','SSSSS-SS') FROM DUAL;
SELECT TO_TIMESTAMP('25361-2','SSSSS-SS');
ERROR: seconds of minute conflicts with seconds in day
CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('25361-41','SSSSS-SS') FROM DUAL;
SELECT TO_TIMESTAMP('25361-41','SSSSS-SS');
to_timestamp
------------------------
0001-01-01 07:02:41 BC
(1 row)
SELECT TO_TIMESTAMP('2650000','J') FROM DUAL;
SELECT TO_TIMESTAMP('2650000','J');
to_timestamp
---------------------
2543-05-09 00:00:00
(1 row)
SELECT TO_TIMESTAMP('2650000-2542','J-YYYY') FROM DUAL;
SELECT TO_TIMESTAMP('2650000-2542','J-YYYY');
ERROR: year conflicts with Julian date
CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('2650000-2543','J-YYYY') FROM DUAL;
SELECT TO_TIMESTAMP('2650000-2543','J-YYYY');
to_timestamp
---------------------
2543-05-09 00:00:00
(1 row)
SELECT TO_TIMESTAMP('2650000-4','J-MM') FROM DUAL;
SELECT TO_TIMESTAMP('2650000-4','J-MM');
ERROR: month conflicts with Julian date
CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('2650000-5','J-MM') FROM DUAL;
SELECT TO_TIMESTAMP('2650000-5','J-MM');
to_timestamp
---------------------
2543-05-09 00:00:00
(1 row)
SELECT TO_TIMESTAMP('2650000-8','J-DD') FROM DUAL;
SELECT TO_TIMESTAMP('2650000-8','J-DD');
ERROR: day conflicts with Julian date
CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('2650000-9','J-DD') FROM DUAL;
SELECT TO_TIMESTAMP('2650000-9','J-DD');
to_timestamp
---------------------
2543-05-09 00:00:00
(1 row)
SELECT TO_TIMESTAMP('2012-245','YYYY-DDD') FROM DUAL;
SELECT TO_TIMESTAMP('2012-245','YYYY-DDD');
to_timestamp
---------------------
2012-09-01 00:00:00
(1 row)
SELECT TO_TIMESTAMP('2012-245-8','YYYY-DDD-MM') FROM DUAL;
SELECT TO_TIMESTAMP('2012-245-8','YYYY-DDD-MM');
ERROR: month conflicts with days of year
CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('2012-245-9','YYYY-DDD-MM') FROM DUAL;
SELECT TO_TIMESTAMP('2012-245-9','YYYY-DDD-MM');
to_timestamp
---------------------
2012-09-01 00:00:00
(1 row)
SELECT TO_TIMESTAMP('2012-245-1','YYYY-DDD-DD') FROM DUAL;
SELECT TO_TIMESTAMP('2012-245-1','YYYY-DDD-DD');
to_timestamp
---------------------
2012-09-01 00:00:00
(1 row)
SELECT TO_TIMESTAMP('2012-245-2','YYYY-DDD-DD') FROM DUAL;
SELECT TO_TIMESTAMP('2012-245-2','YYYY-DDD-DD');
ERROR: days of month conflicts with days of year
CONTEXT: referenced column: to_timestamp
--MS
SELECT TO_TIMESTAMP('-1','MS') FROM DUAL;
SELECT TO_TIMESTAMP('-1','MS');
ERROR: invalid data for "millisecond = -10" ,value must be between 0 and 999
CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('0','MS') FROM DUAL;
SELECT TO_TIMESTAMP('0','MS');
to_timestamp
------------------------
0001-01-01 00:00:00 BC
(1 row)
SELECT TO_TIMESTAMP('256','MS') FROM DUAL;
SELECT TO_TIMESTAMP('256','MS');
to_timestamp
----------------------------
0001-01-01 00:00:00.256 BC
(1 row)
SELECT TO_TIMESTAMP('999','MS') FROM DUAL;
SELECT TO_TIMESTAMP('999','MS');
to_timestamp
----------------------------
0001-01-01 00:00:00.999 BC
(1 row)
SELECT TO_TIMESTAMP('1000','MS') FROM DUAL;
SELECT TO_TIMESTAMP('1000','MS');
ERROR: invalid data for "millisecond = 1000" ,value must be between 0 and 999
CONTEXT: referenced column: to_timestamp
--WW
SELECT TO_TIMESTAMP('0','WW') FROM DUAL;
SELECT TO_TIMESTAMP('0','WW');
ERROR: invalid data for "week number of year = 0" ,value must be between 1 and 53
CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('1','WW') FROM DUAL;
SELECT TO_TIMESTAMP('1','WW');
ERROR: cannot calculate day of year without year information
CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('10','WW') FROM DUAL;
SELECT TO_TIMESTAMP('10','WW');
ERROR: cannot calculate day of year without year information
CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('53','WW') FROM DUAL;
SELECT TO_TIMESTAMP('53','WW');
ERROR: cannot calculate day of year without year information
CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('54','WW') FROM DUAL;
SELECT TO_TIMESTAMP('54','WW');
ERROR: invalid data for "week number of year = 54" ,value must be between 1 and 53
CONTEXT: referenced column: to_timestamp
--D
SELECT TO_TIMESTAMP('0','D') FROM DUAL;
SELECT TO_TIMESTAMP('0','D');
ERROR: invalid data for "day = 0" ,value must be between 1 and 7
CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('1','D') FROM DUAL;
SELECT TO_TIMESTAMP('1','D');
to_timestamp
------------------------
0001-01-01 00:00:00 BC
(1 row)
SELECT TO_TIMESTAMP('4','D') FROM DUAL;
SELECT TO_TIMESTAMP('4','D');
to_timestamp
------------------------
0001-01-01 00:00:00 BC
(1 row)
SELECT TO_TIMESTAMP('7','D') FROM DUAL;
SELECT TO_TIMESTAMP('7','D');
to_timestamp
------------------------
0001-01-01 00:00:00 BC
(1 row)
SELECT TO_TIMESTAMP('8','D') FROM DUAL;
SELECT TO_TIMESTAMP('8','D');
ERROR: invalid data for "day = 8" ,value must be between 1 and 7
CONTEXT: referenced column: to_timestamp
--WW & D YYYY
SELECT TO_TIMESTAMP('2012-50-0','YYYY-WW-D') FROM DUAL;
SELECT TO_TIMESTAMP('2012-50-0','YYYY-WW-D');
ERROR: invalid data for "day = 0" ,value must be between 1 and 7
CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('2012-50-1','YYYY-WW-D') FROM DUAL;
SELECT TO_TIMESTAMP('2012-50-1','YYYY-WW-D');
to_timestamp
---------------------
2012-12-09 00:00:00
(1 row)
SELECT TO_TIMESTAMP('2012-50-4','YYYY-WW-D') FROM DUAL;
SELECT TO_TIMESTAMP('2012-50-4','YYYY-WW-D');
to_timestamp
---------------------
2012-12-09 00:00:00
(1 row)
SELECT TO_TIMESTAMP('2012-50-7','YYYY-WW-D') FROM DUAL;
SELECT TO_TIMESTAMP('2012-50-7','YYYY-WW-D');
to_timestamp
---------------------
2012-12-09 00:00:00
(1 row)
SELECT TO_TIMESTAMP('2012-50-8','YYYY-WW-D') FROM DUAL;
SELECT TO_TIMESTAMP('2012-50-8','YYYY-WW-D');
ERROR: invalid data for "day = 8" ,value must be between 1 and 7
CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('2012-0-4','YYYY-WW-D') FROM DUAL;
SELECT TO_TIMESTAMP('2012-0-4','YYYY-WW-D');
ERROR: invalid data for "week number of year = 0" ,value must be between 1 and 53
CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('2012-1-4','YYYY-WW-D') FROM DUAL;
SELECT TO_TIMESTAMP('2012-1-4','YYYY-WW-D');
to_timestamp
---------------------
2012-01-01 00:00:00
(1 row)
SELECT TO_TIMESTAMP('2012-50-4','YYYY-WW-D') FROM DUAL;
SELECT TO_TIMESTAMP('2012-50-4','YYYY-WW-D');
to_timestamp
---------------------
2012-12-09 00:00:00
(1 row)
SELECT TO_TIMESTAMP('2012-53-4','YYYY-WW-D') FROM DUAL;
SELECT TO_TIMESTAMP('2012-53-4','YYYY-WW-D');
to_timestamp
---------------------
2012-12-30 00:00:00
(1 row)
SELECT TO_TIMESTAMP('2012-54-4','YYYY-WW-D') FROM DUAL;
SELECT TO_TIMESTAMP('2012-54-4','YYYY-WW-D');
ERROR: invalid data for "week number of year = 54" ,value must be between 1 and 53
CONTEXT: referenced column: to_timestamp
--US
SELECT TO_TIMESTAMP('-1','US') FROM DUAL;
SELECT TO_TIMESTAMP('-1','US');
ERROR: invalid data for "microsecond = -10000" ,value must be between 1 and 999999
CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('0','US') FROM DUAL;
SELECT TO_TIMESTAMP('0','US');
to_timestamp
------------------------
0001-01-01 00:00:00 BC
(1 row)
SELECT TO_TIMESTAMP('99999','US') FROM DUAL;
SELECT TO_TIMESTAMP('99999','US');
to_timestamp
------------------------------
0001-01-01 00:00:00.99999 BC
(1 row)
SELECT TO_TIMESTAMP('999999','US') FROM DUAL;
SELECT TO_TIMESTAMP('999999','US');
to_timestamp
-------------------------------
0001-01-01 00:00:00.999999 BC
(1 row)
SELECT TO_TIMESTAMP('1000000','US') FROM DUAL;
SELECT TO_TIMESTAMP('1000000','US');
ERROR: input length of format 'US'/'us'/'FF'/'ff' must between 0 and 6
CONTEXT: referenced column: to_timestamp
--W
SELECT TO_TIMESTAMP('-1','W') FROM DUAL;
SELECT TO_TIMESTAMP('-1','W');
ERROR: invalid data for "week of month = -1" ,value must be between 1 and 5
CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('0','W') FROM DUAL;
SELECT TO_TIMESTAMP('0','W');
ERROR: invalid data for "week of month = 0" ,value must be between 1 and 5
CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('1','W') FROM DUAL;
SELECT TO_TIMESTAMP('1','W');
to_timestamp
------------------------
0001-01-01 00:00:00 BC
(1 row)
SELECT TO_TIMESTAMP('5','W') FROM DUAL;
SELECT TO_TIMESTAMP('5','W');
to_timestamp
------------------------
0001-01-29 00:00:00 BC
(1 row)
SELECT TO_TIMESTAMP('6','W') FROM DUAL;
SELECT TO_TIMESTAMP('6','W');
ERROR: invalid data for "week of month = 6" ,value must be between 1 and 5
CONTEXT: referenced column: to_timestamp
SHOW nls_timestamp_format;
@ -633,55 +633,55 @@ SHOW nls_timestamp_format;
DD-Mon-YYYY HH:MI:SS.FF AM
(1 row)
SELECT TO_TIMESTAMP('01') FROM DUAL;
SELECT TO_TIMESTAMP('01');
to_timestamp
------------------------
0001-01-01 00:00:00 BC
(1 row)
SELECT TO_TIMESTAMP('01-Sep') FROM DUAL;
SELECT TO_TIMESTAMP('01-Sep');
to_timestamp
------------------------
0001-09-01 00:00:00 BC
(1 row)
SELECT TO_TIMESTAMP('01-Sep-1998') FROM DUAL;
SELECT TO_TIMESTAMP('01-Sep-1998');
to_timestamp
---------------------
1998-09-01 00:00:00
(1 row)
SELECT TO_TIMESTAMP('01-Sep-1998 11') FROM DUAL;
SELECT TO_TIMESTAMP('01-Sep-1998 11');
to_timestamp
---------------------
1998-09-01 11:00:00
(1 row)
SELECT TO_TIMESTAMP('01-Sep-1998 11:12') FROM DUAL;
SELECT TO_TIMESTAMP('01-Sep-1998 11:12');
to_timestamp
---------------------
1998-09-01 11:12:00
(1 row)
SELECT TO_TIMESTAMP('01-Sep-1998 11:12:13') FROM DUAL;
SELECT TO_TIMESTAMP('01-Sep-1998 11:12:13');
to_timestamp
---------------------
1998-09-01 11:12:13
(1 row)
SELECT TO_TIMESTAMP('01-Sep-1998 11:12:13.12') FROM DUAL;
SELECT TO_TIMESTAMP('01-Sep-1998 11:12:13.12');
to_timestamp
------------------------
1998-09-01 11:12:13.12
(1 row)
SELECT TO_TIMESTAMP('01-Sep-1998 11:12:13.12 PM') FROM DUAL;
SELECT TO_TIMESTAMP('01-Sep-1998 11:12:13.12 PM');
to_timestamp
------------------------
1998-09-01 23:12:13.12
(1 row)
SELECT TO_TIMESTAMP('01-Sep-1998 11:12:13 PM') FROM DUAL;
SELECT TO_TIMESTAMP('01-Sep-1998 11:12:13 PM');
ERROR: invalid value "PM" for "FF"
DETAIL: Value must be an integer.
CONTEXT: referenced column: to_timestamp
@ -692,65 +692,65 @@ SHOW nls_timestamp_format;
YYYY-MM-DD HH:MI:SS.FF AM
(1 row)
SELECT TO_TIMESTAMP('1998') FROM DUAL;
SELECT TO_TIMESTAMP('1998');
to_timestamp
---------------------
1998-01-01 00:00:00
(1 row)
SELECT TO_TIMESTAMP('1998-12-28') FROM DUAL;
SELECT TO_TIMESTAMP('1998-12-28');
to_timestamp
---------------------
1998-12-28 00:00:00
(1 row)
SELECT TO_TIMESTAMP('1998-12-28 01') FROM DUAL;
SELECT TO_TIMESTAMP('1998-12-28 01');
to_timestamp
---------------------
1998-12-28 01:00:00
(1 row)
SELECT TO_TIMESTAMP('1998-12-28 01:02') FROM DUAL;
SELECT TO_TIMESTAMP('1998-12-28 01:02');
to_timestamp
---------------------
1998-12-28 01:02:00
(1 row)
SELECT TO_TIMESTAMP('1998-12-28 01:02:03') FROM DUAL;
SELECT TO_TIMESTAMP('1998-12-28 01:02:03');
to_timestamp
---------------------
1998-12-28 01:02:03
(1 row)
SELECT TO_TIMESTAMP('1998-12-28 01:02:03.12') FROM DUAL;
SELECT TO_TIMESTAMP('1998-12-28 01:02:03.12');
to_timestamp
------------------------
1998-12-28 01:02:03.12
(1 row)
SELECT TO_TIMESTAMP('1998-12-28 01:02:03.12 AM') FROM DUAL;
SELECT TO_TIMESTAMP('1998-12-28 01:02:03.12 AM');
to_timestamp
------------------------
1998-12-28 01:02:03.12
(1 row)
SELECT TO_TIMESTAMP('1998-12-28 11:12:13 PM') FROM DUAL;
SELECT TO_TIMESTAMP('1998-12-28 11:12:13 PM');
ERROR: invalid value "PM" for "FF"
DETAIL: Value must be an integer.
CONTEXT: referenced column: to_timestamp
SELECT TO_TIMESTAMP('01') FROM DUAL;
SELECT TO_TIMESTAMP('01');
to_timestamp
---------------------
0001-01-01 00:00:00
(1 row)
select to_date('2018--12;30', 'yyyy//mm/,,dd') from dual;
select to_date('2018--12;30', 'yyyy//mm/,,dd');
to_date
---------------------
2018-12-30 00:00:00
(1 row)
select to_date('2018-12 30', 'yyyy//mm/dd') from dual;
select to_date('2018-12 30', 'yyyy//mm/dd');
to_date
---------------------
2018-12-30 00:00:00
@ -762,20 +762,20 @@ select to_date('20181231124559','yyyy-MM-dd hh24:mi:ss');
2018-12-31 12:45:59
(1 row)
SELECT (TO_DATE('1999(12*23 12 26','yyyy-MM-dd hh24:mi:ss')) FROM dual;
SELECT (TO_DATE('1999(12*23 12 26','yyyy-MM-dd hh24:mi:ss'));
to_date
---------------------
1999-12-23 12:26:00
(1 row)
SELECT (TO_DATE('1999(12*23 12 26','yyyy-MM-dd hh24:mi:ss')) FROM dual;
SELECT (TO_DATE('1999(12*23 12 26','yyyy-MM-dd hh24:mi:ss'));
to_date
---------------------
1999-12-23 12:26:00
(1 row)
SELECT (TO_DATE('1999(12*23 12
26','yyyy-MM-dd hh24:mi:ss')) FROM dual;
26','yyyy-MM-dd hh24:mi:ss'));
to_date
---------------------
1999-12-23 12:26:00
@ -787,31 +787,31 @@ SELECT to_date('10', 'SSSSS');
0001-01-01 00:00:10 BC
(1 row)
SELECT TO_TIMESTAMP('01', 'yyyy-MM-dd') FROM DUAL;
SELECT TO_TIMESTAMP('01', 'yyyy-MM-dd');
to_timestamp
---------------------
0001-01-01 00:00:00
(1 row)
SELECT TO_CHAR(TO_DATE('27OCT17', 'DDMONRR') ,'YYYY') "Year" FROM DUAL;
SELECT TO_CHAR(TO_DATE('27OCT17', 'DDMONRR') ,'YYYY') "Year";
Year
------
2017
(1 row)
SELECT TO_CHAR(TO_DATE('27-OCT98', 'DD-MON-RR') ,'YYYY') "Year" FROM DUAL;
SELECT TO_CHAR(TO_DATE('27-OCT98', 'DD-MON-RR') ,'YYYY') "Year";
Year
------
1998
(1 row)
SELECT TO_CHAR(TO_DATE('27DEC98', 'DDMON-RR') ,'MON') "Month" FROM DUAL;
SELECT TO_CHAR(TO_DATE('27DEC98', 'DDMON-RR') ,'MON') "Month";
Month
-------
DEC
(1 row)
SELECT TO_CHAR(TO_DATE('27/OCT/17', 'DD-MON-RR') ,'DD') "Year" FROM DUAL;
SELECT TO_CHAR(TO_DATE('27/OCT/17', 'DD-MON-RR') ,'DD') "Year";
Year
------
27

View File

@ -53,7 +53,7 @@ SELECT INTERVAL '10 years -11 month -12 days +13:14' AS "9 years...";
(1 row)
--check interval concat null
SELECT '' || INTERVAL '10 years -11 month -12 days +13:14' AS "9 years..." from dual;
SELECT '' || INTERVAL '10 years -11 month -12 days +13:14' AS "9 years...";
9 years...
----------------------------------
9 years 1 mon -12 days +13:14:00
@ -715,7 +715,7 @@ SELECT interval '1 2:03:04.5678' minute to second(2);
(1 row)
--check interval concat with null
SELECT interval '1 2:03:04.5678' minute to second(2) || '' from dual;
SELECT interval '1 2:03:04.5678' minute to second(2) || '';
?column?
-------------------
1 day 02:03:04.57

View File

@ -1,11 +1,11 @@
-- add test case into 'case DCH_RRRR' and 'case DCH_RR' in DCH_from_char function, then the function adjust_partial_year_to_current_year will covered:
select to_date('06-JAN-40 00:00:00','DD-MON-RRRR HH24:MI:SS') from dual;
select to_date('06-JAN-40 00:00:00','DD-MON-RRRR HH24:MI:SS');
to_date
--------------------------
Fri Jan 06 00:00:00 2040
(1 row)
select to_date('01/05/81','dd/mm/rr') from dual;
select to_date('01/05/81','dd/mm/rr');
to_date
--------------------------
Fri May 01 00:00:00 1981

View File

@ -33,18 +33,16 @@ explain (verbose on, costs off) select 1 where 'vasya' = (select 'vasya' as col1
Output: 'vasya'::text
(6 rows)
explain (verbose on, costs off) select 1 where 'vasya' = (select 'vasya' as col1 from dual where col1 <> 'aaa');
explain (verbose on, costs off) select 1 where 'vasya' = (select 'vasya' as col1 where col1 <> 'aaa');
QUERY PLAN
-----------------------------------------
Result
Output: 1
One-Time Filter: ('vasya'::text = $0)
InitPlan 1 (returns $0)
-> Subquery Scan on dual
-> Result
Output: 'vasya'::text
-> Result
Output: 'X'::text
(8 rows)
(6 rows)
select 1 where 'vasya' = (select 'vasya' as col1);
?column?
@ -58,7 +56,7 @@ select 1 where 'vasya' = (select 'vasya' as col1 where col1 <> 'aaa');
1
(1 row)
select 1 where 'vasya' = (select 'vasya' as col1 from dual where col1 <> 'aaa');
select 1 where 'vasya' = (select 'vasya' as col1 where col1 <> 'aaa');
?column?
----------
1
@ -239,7 +237,7 @@ INSERT INTO test_unknown(a, b) VALUES (4, 'suzhou'), (5, 'hangzhou') ORDER BY 1
ERROR: column "b" is of type unknown but expression is of type text
HINT: You will need to rewrite or cast the expression.
CONTEXT: referenced column: b
INSERT INTO test_unknown(a, b) SELECT 6, 'xian' FROM DUAL;
INSERT INTO test_unknown(a, b) SELECT 6, 'xian';
TABLE test_unknown ORDER BY a;
a | b | c
---+----------+---
@ -260,7 +258,7 @@ INSERT INTO test_unknown(a, b) VALUES (4, 'suzhou'), (5, 'hangzhou') ORDER BY 1
ERROR: column "b" is of type unknown but expression is of type text
HINT: You will need to rewrite or cast the expression.
CONTEXT: referenced column: b
INSERT INTO test_unknown(a, b) SELECT 6, 'xian' FROM DUAL;
INSERT INTO test_unknown(a, b) SELECT 6, 'xian';
TABLE test_unknown ORDER BY a;
a | b | c
---+----------+---

View File

@ -231,13 +231,13 @@ select rownum rn from distributors group by rn;
4
(4 rows)
select rownum + 1 from dual group by rownum;
select rownum + 1 group by rownum;
?column?
----------
2
(1 row)
select rownum + 1 rn from dual group by rn;
select rownum + 1 rn group by rn;
rn
----
2

View File

@ -198,7 +198,7 @@ b varchar;
sql_srt varchar(100);
cursor c1 is select c1,c2 from cursor_vl_tb10 order by 1,2;
begin
sql_srt :='insert into cursor_vl_tb10(c1,c2) select :1,:1+1 from dual;';
sql_srt :='insert into cursor_vl_tb10(c1,c2) select :1,:1+1;';
while a1 > 0 loop
execute immediate sql_srt using IN a1;
a1:=a1-1;

View File

@ -178,8 +178,8 @@ BEGIN
END;
$$ LANGUAGE plpgsql;
select TEST_FUNC('abc'::clob) from dual;
select TEST_FUNC('abc'::varchar2) from dual;
select TEST_FUNC('abc'::clob);
select TEST_FUNC('abc'::varchar2);
drop function test_func(char);
--VARCHAR2
@ -189,14 +189,14 @@ BEGIN
END;
$$ LANGUAGE plpgsql;
select TEST_FUNC('abc'::clob) from dual;
select TEST_FUNC(123) from dual;
select TEST_FUNC('123'::integer) from dual;
select TEST_FUNC('abc'::raw) from dual;
select TEST_FUNC('abc'::char) from dual;
select TEST_FUNC('2012-08-01 11:23:45'::timestamp) from dual; --with timezone?
select TEST_FUNC(interval '1 18:00:00' day to second) from dual;
select TEST_FUNC('1 day 18:00:00') from dual;
select TEST_FUNC('abc'::clob);
select TEST_FUNC(123);
select TEST_FUNC('123'::integer);
select TEST_FUNC('abc'::raw);
select TEST_FUNC('abc'::char);
select TEST_FUNC('2012-08-01 11:23:45'::timestamp); --with timezone?
select TEST_FUNC(interval '1 18:00:00' day to second);
select TEST_FUNC('1 day 18:00:00');
drop function test_func(varchar2);
@ -207,8 +207,8 @@ BEGIN
END;
$$ LANGUAGE plpgsql;
select TEST_FUNC('abc'::char) from dual;
select TEST_FUNC('abc'::varchar2) from dual;
select TEST_FUNC('abc'::char);
select TEST_FUNC('abc'::varchar2);
drop function test_func(clob);
@ -219,8 +219,8 @@ BEGIN
END;
$$ LANGUAGE plpgsql;
select TEST_FUNC('123'::char(3)) from dual;
select TEST_FUNC('123'::varchar2) from dual;
select TEST_FUNC('123'::char(3));
select TEST_FUNC('123'::varchar2);
drop function test_func(integer);
--TIMESTAMP
@ -230,8 +230,8 @@ BEGIN
END;
$$ LANGUAGE plpgsql;
select TEST_FUNC('2012-08-01 11:23:45'::char(20)) from dual;
select TEST_FUNC('2012-08-01 11:23:45'::varchar2) from dual;
select TEST_FUNC('2012-08-01 11:23:45'::char(20));
select TEST_FUNC('2012-08-01 11:23:45'::varchar2);
drop function test_func(timestamp);
--INTERVAL
@ -240,8 +240,8 @@ BEGIN
raise info'TEST INTERVAL VALUE IS %',tempdata;
END;
$$ LANGUAGE plpgsql;
select TEST_FUNC('1 day 18:00:00'::char(20)) from dual;
select TEST_FUNC('1 day 18:00:00'::varchar2) from dual;
select TEST_FUNC('1 day 18:00:00'::char(20));
select TEST_FUNC('1 day 18:00:00'::varchar2);
drop function test_func(INTERVAL);
create function ftime(a abstime)returns int
@ -964,13 +964,13 @@ select 2 > '15'::text;
SELECT pg_catalog.array_dims(' '::anyarray) AS a
,LENGTH(pg_catalog.array_dims(' '::anyarray)) AS b
FROM dual;
;
SELECT pg_catalog.array_to_string(' '::anyarray,' '::text) AS a
,LENGTH(pg_catalog.array_to_string(' '::anyarray,' '::text)) AS b
FROM dual;
;
SELECT pg_catalog.array_to_string(' '::anyarray,' '::text,''::text) AS a
,LENGTH(pg_catalog.array_to_string(' '::anyarray,' '::text,' '::text)) AS b
FROM dual;
;
SELECT pg_catalog.array_dims('{1,2,3}'::anyarray) AS a
,LENGTH(pg_catalog.array_dims('{1,2,3}'::anyarray)) AS b
FROM dual;
;

View File

@ -185,14 +185,14 @@ drop table date_smalldate;
--INTERAL TO NUMERIC
create table test_num(mynum numeric);
select to_date('2013-03-14 14:27:00','YYYY-MM-DD HH24:MI:SS') - to_date('2013-3-1 9:00:00','YYYY-MM-DD HH24:MI:SS') from dual;
select to_date('2013-03-14 14:27:00','YYYY-MM-DD HH24:MI:SS') - to_date('2013-3-1 9:00:00','YYYY-MM-DD HH24:MI:SS');
insert into test_num values(to_date('2013-03-14 14:27:00','YYYY-MM-DD HH24:MI:SS') - to_date('2013-3-1 9:00:00','YYYY-MM-DD HH24:MI:SS'));
select mynum from test_num order by 1;
insert into test_num values(interval '2 days 09:33:00');
select mynum from test_num order by 1;
select floor(mynum) from test_num order by 1;
drop table test_num;
select floor(interval '2 days 09:33:00') from dual;
select floor(interval '2 days 09:33:00');
create or replace procedure test_interval_to_num(my_num numeric)
as

View File

@ -18,8 +18,8 @@ insert into test_tb values (1, '');
select * from test_tb where name is null;
drop table test_tb;
-- select * from ( select 'NULL' from dual);
select * from ( select 'NULL' from dual) as a;
-- select * from ( select 'NULL');
select * from ( select 'NULL') as a;
/*
* function test
@ -37,14 +37,14 @@ select ltrim('abc', 'a') is not null;
/* The following case depence on nvl which is added by GuassDB */
/* expect is null */
select nvl(ltrim(NULL), 'is null') from dual;
select nvl(ltrim(''), 'is null') from dual;
select nvl(ltrim('', 'ab'), 'is null') from dual;
select nvl(ltrim(NULL, 'ab'), 'is null') from dual;
select nvl(ltrim('ab', ''), 'is null') from dual;
select nvl(ltrim('ab', NULL), 'is null') from dual;
select nvl(ltrim('ab', 'ab'), 'is null') from dual;
select nvl(ltrim('abc', 'a'), 'is not null') from dual; -- return bc
select nvl(ltrim(NULL), 'is null');
select nvl(ltrim(''), 'is null');
select nvl(ltrim('', 'ab'), 'is null');
select nvl(ltrim(NULL, 'ab'), 'is null');
select nvl(ltrim('ab', ''), 'is null');
select nvl(ltrim('ab', NULL), 'is null');
select nvl(ltrim('ab', 'ab'), 'is null');
select nvl(ltrim('abc', 'a'), 'is not null'); -- return bc
/* expect t */
@ -117,8 +117,8 @@ select * from test_table where regexp_like(name,'', 'i'); ---return null
select * from test_table where regexp_like(name, NULL, 'i'); -- return null
drop table test_table;
select nvl(regexp_substr('This is test',''), 'This is NULL') from dual; -- return This is NULL
select nvl(regexp_substr('This is test',NULL), 'This is NULL') from dual; -- return This is NULL
select nvl(regexp_substr('This is test',''), 'This is NULL'); -- return This is NULL
select nvl(regexp_substr('This is test',NULL), 'This is NULL'); -- return This is NULL
select concat(NULL, NULL) is null;

View File

@ -10,7 +10,7 @@ AS
END;
/
SELECT test_return(1) from dual;
SELECT test_return(1);
declare
a int := 1;
@ -47,7 +47,7 @@ AS
END;
/
SELECT test_return1(1) from dual;
SELECT test_return1(1);
declare
a int := 1;
@ -127,7 +127,7 @@ AS
END;
/
SELECT test_return5(1) from dual;
SELECT test_return5(1);
declare
a int := 1;
@ -610,7 +610,7 @@ AS
END;
/
SELECT test_return(1) from dual;
SELECT test_return(1);
declare
a int := 1;
@ -647,7 +647,7 @@ AS
END;
/
SELECT test_return1(1) from dual;
SELECT test_return1(1);
declare
a int := 1;
@ -727,7 +727,7 @@ AS
END;
/
SELECT test_return5(1) from dual;
SELECT test_return5(1);
declare
a int := 1;

View File

@ -63,7 +63,7 @@ returns integer
language plpgsql
as $$ declare
begin
create temp table test_create_tmp as (select sysdate as s from dual);
create temp table test_create_tmp as (select sysdate as s);
ret :=0;
end $$
;
@ -146,12 +146,12 @@ returns integer
language plpgsql
as $$ declare
begin
create temp table test_create_tmp as (select sysdate as s from dual);
create temp table test_create_tmp as (select sysdate as s);
ret :=0;
insert into test_create_tmp_no_exit values (2);
exception
when others then
create temp table test_create_tmp as (select sysdate as s from dual);
create temp table test_create_tmp as (select sysdate as s);
ret :=1;
end $$
;

View File

@ -106,16 +106,16 @@ select numtodsinterval(-0.1,'HOUR');
select numtodsinterval(150032,'second');
select numtodsinterval(-.1500321234,'second');
--boundary test
SELECT numtodsinterval(-2147483648, 'DAY')from dual;
SELECT numtodsinterval(-2147483648, 'HOUR')from dual;
SELECT numtodsinterval(-2147483648, 'MINUTE')from dual;
SELECT numtodsinterval(-2147483648, 'SECOND')from dual;
SELECT numtodsinterval(2147483647, 'DAY')from dual;
SELECT numtodsinterval(999999999.99999999999, 'DAY')from dual;
SELECT numtodsinterval(2147483647, 'HOUR')from dual;
SELECT numtodsinterval(2147483647, 'MINUTE')from dual;
SELECT numtodsinterval(2147483647, 'SECOND')from dual;
SELECT numtodsinterval(123456789.123456789, 'DAY')from dual;
SELECT numtodsinterval(-2147483648, 'DAY');
SELECT numtodsinterval(-2147483648, 'HOUR');
SELECT numtodsinterval(-2147483648, 'MINUTE');
SELECT numtodsinterval(-2147483648, 'SECOND');
SELECT numtodsinterval(2147483647, 'DAY');
SELECT numtodsinterval(999999999.99999999999, 'DAY');
SELECT numtodsinterval(2147483647, 'HOUR');
SELECT numtodsinterval(2147483647, 'MINUTE');
SELECT numtodsinterval(2147483647, 'SECOND');
SELECT numtodsinterval(123456789.123456789, 'DAY');
SELECT '2147483647 days 24 hours'::interval;
set intervalstyle=postgres;

View File

@ -224,7 +224,7 @@ explain (format JSON) select a, b, c from vec_t1 group by rollup(a, b, c);
explain (format YAML) select a, b, c from vec_t1 group by rollup(a, b, c);
\o
drop table vec_t1;
select 1 a,2,count(*) from dual group by cube(1,2) having count(*)=1 order by 1, 2;
select 1 a,2,count(*) group by cube(1,2) having count(*)=1 order by 1, 2;
create table vec_t1(a int)with(orientation = column);
insert into vec_t1 values(1);

View File

@ -43,169 +43,169 @@ SELECT TO_TIMESTAMP('60','DDD-PS');
SELECT TO_TIMESTAMP('366-4','YYYY-P');
SELECT TO_TIMESTAMP('366-4','YYYY-DD-12');
select to_timestamp('-4713','YYYY') from dual;
select to_timestamp('-4712','YYYY') from dual;
select to_timestamp('-1','YYYY') from dual;
select to_timestamp('0','YYYY') from dual;
select to_timestamp('1','YYYY') from dual;
select to_timestamp('9999','YYYY') from dual;
select to_timestamp('10000','YYYY') from dual;
select to_timestamp('-4713','YYYY');
select to_timestamp('-4712','YYYY');
select to_timestamp('-1','YYYY');
select to_timestamp('0','YYYY');
select to_timestamp('1','YYYY');
select to_timestamp('9999','YYYY');
select to_timestamp('10000','YYYY');
select to_timestamp('10','H24') from dual;
select to_timestamp('10','H24') from dual;
select to_timestamp('10','H24');
select to_timestamp('10','H24');
SELECT to_timestamp('-2012-2/3,21.15;36:18','YYYY-MM/DD,HH24.MI;SS:FF') FROM DUAL;
SELECT to_timestamp('-1-2/3,21.15;36:18','YYYY-MM/DD,HH24.MI;SS:FF') FROM DUAL;
SELECT to_timestamp('0-2/3,21.15;36:18','YYYY-MM/DD,HH24.MI;SS:FF') FROM DUAL;
SELECT to_timestamp('9999-2/3,21.15;36:18','YYYY-MM/DD,HH24.MI;SS:FF') FROM DUAL;
SELECT to_timestamp('10000-2/3,21.15;36:18','YYYY-MM/DD,HH24.MI;SS:FF') FROM DUAL;
SELECT to_timestamp('-2012-2/3,21.15;36:18','YYYY-MM/DD,HH24.MI;SS:FF');
SELECT to_timestamp('-1-2/3,21.15;36:18','YYYY-MM/DD,HH24.MI;SS:FF');
SELECT to_timestamp('0-2/3,21.15;36:18','YYYY-MM/DD,HH24.MI;SS:FF');
SELECT to_timestamp('9999-2/3,21.15;36:18','YYYY-MM/DD,HH24.MI;SS:FF');
SELECT to_timestamp('10000-2/3,21.15;36:18','YYYY-MM/DD,HH24.MI;SS:FF');
select to_timestamp('-4713-3-4 13:2:3.234015', 'syyyy-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-4712-3-4 13:2:3.234015', 'syyyy-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('0-3-4 13:2:3.234015', 'syyyy-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('9999-3-4 13:2:3.234015', 'syyyy-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('10000-3-4 13:2:3.234015', 'syyyy-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-4713-3-4 13:2:3.234015', 'syyyy-mm-dd hh24:mi:ss.ff');
select to_timestamp('-4712-3-4 13:2:3.234015', 'syyyy-mm-dd hh24:mi:ss.ff');
select to_timestamp('0-3-4 13:2:3.234015', 'syyyy-mm-dd hh24:mi:ss.ff');
select to_timestamp('9999-3-4 13:2:3.234015', 'syyyy-mm-dd hh24:mi:ss.ff');
select to_timestamp('10000-3-4 13:2:3.234015', 'syyyy-mm-dd hh24:mi:ss.ff');
select to_timestamp('-4713-3-4 13:2:3.234015', 'SYYYY-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-4712-3-4 13:2:3.234015', 'SYYYY-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('0-3-4 13:2:3.234015', 'SYYYY-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('9999-3-4 13:2:3.234015', 'SYYYY-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('10000-3-4 13:2:3.234015', 'SYYYY-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-4713-3-4 13:2:3.234015', 'SYYYY-mm-dd hh24:mi:ss.ff');
select to_timestamp('-4712-3-4 13:2:3.234015', 'SYYYY-mm-dd hh24:mi:ss.ff');
select to_timestamp('0-3-4 13:2:3.234015', 'SYYYY-mm-dd hh24:mi:ss.ff');
select to_timestamp('9999-3-4 13:2:3.234015', 'SYYYY-mm-dd hh24:mi:ss.ff');
select to_timestamp('10000-3-4 13:2:3.234015', 'SYYYY-mm-dd hh24:mi:ss.ff');
select to_timestamp('-4713-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-4712-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-1-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('0-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('1-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('9999-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('10000-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-4713-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff');
select to_timestamp('-4712-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff');
select to_timestamp('-1-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff');
select to_timestamp('0-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff');
select to_timestamp('1-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff');
select to_timestamp('9999-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff');
select to_timestamp('10000-3-4 13:2:3.234015', 'RR-mm-dd hh24:mi:ss.ff');
select to_timestamp('-4713-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-4712-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-1-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('0-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('1-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('9999-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('10000-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-4713-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff');
select to_timestamp('-4712-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff');
select to_timestamp('-1-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff');
select to_timestamp('0-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff');
select to_timestamp('1-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff');
select to_timestamp('9999-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff');
select to_timestamp('10000-3-4 13:2:3.234015', 'RRRR-mm-dd hh24:mi:ss.ff');
select to_timestamp('-4713-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-4712-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-1-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('0-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('1-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('9999-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('10000-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-4713-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff');
select to_timestamp('-4712-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff');
select to_timestamp('-1-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff');
select to_timestamp('0-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff');
select to_timestamp('1-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff');
select to_timestamp('9999-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff');
select to_timestamp('10000-3-4 13:2:3.234015', 'rr-mm-dd hh24:mi:ss.ff');
select to_timestamp('-4713-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-4712-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-1-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('0-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('1-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('9999-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('10000-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff') from dual;
select to_timestamp('-4713-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff');
select to_timestamp('-4712-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff');
select to_timestamp('-1-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff');
select to_timestamp('0-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff');
select to_timestamp('1-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff');
select to_timestamp('9999-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff');
select to_timestamp('10000-3-4 13:2:3.234015', 'rrrr-mm-dd hh24:mi:ss.ff');
SELECT TO_TIMESTAMP('0000-09-01','YYYYY-MM-DD') FROM DUAL;
SELECT TO_TIMESTAMP('0000-09-01','SYYYYY-MM-DD') FROM DUAL;
SELECT TO_TIMESTAMP('0000-09-01','SYYYY-Y-MM-DD') FROM DUAL;
SELECT TO_TIMESTAMP('0000-09-01','YYYYY-MM-DD');
SELECT TO_TIMESTAMP('0000-09-01','SYYYYY-MM-DD');
SELECT TO_TIMESTAMP('0000-09-01','SYYYY-Y-MM-DD');
SELECT TO_TIMESTAMP('25361','SSSSS') FROM DUAL;
SELECT TO_TIMESTAMP('25361-2','SSSSS-HH12') FROM DUAL;
SELECT TO_TIMESTAMP('25361-07','SSSSS-HH12') FROM DUAL;
SELECT TO_TIMESTAMP('25361-2','SSSSS-MI') FROM DUAL;
SELECT TO_TIMESTAMP('25361-10','SSSSS-MI') FROM DUAL;
SELECT TO_TIMESTAMP('25361-2','SSSSS-SS') FROM DUAL;
SELECT TO_TIMESTAMP('25361-41','SSSSS-SS') FROM DUAL;
SELECT TO_TIMESTAMP('25361','SSSSS');
SELECT TO_TIMESTAMP('25361-2','SSSSS-HH12');
SELECT TO_TIMESTAMP('25361-07','SSSSS-HH12');
SELECT TO_TIMESTAMP('25361-2','SSSSS-MI');
SELECT TO_TIMESTAMP('25361-10','SSSSS-MI');
SELECT TO_TIMESTAMP('25361-2','SSSSS-SS');
SELECT TO_TIMESTAMP('25361-41','SSSSS-SS');
SELECT TO_TIMESTAMP('2650000','J') FROM DUAL;
SELECT TO_TIMESTAMP('2650000-2542','J-YYYY') FROM DUAL;
SELECT TO_TIMESTAMP('2650000-2543','J-YYYY') FROM DUAL;
SELECT TO_TIMESTAMP('2650000-4','J-MM') FROM DUAL;
SELECT TO_TIMESTAMP('2650000-5','J-MM') FROM DUAL;
SELECT TO_TIMESTAMP('2650000-8','J-DD') FROM DUAL;
SELECT TO_TIMESTAMP('2650000-9','J-DD') FROM DUAL;
SELECT TO_TIMESTAMP('2650000','J');
SELECT TO_TIMESTAMP('2650000-2542','J-YYYY');
SELECT TO_TIMESTAMP('2650000-2543','J-YYYY');
SELECT TO_TIMESTAMP('2650000-4','J-MM');
SELECT TO_TIMESTAMP('2650000-5','J-MM');
SELECT TO_TIMESTAMP('2650000-8','J-DD');
SELECT TO_TIMESTAMP('2650000-9','J-DD');
SELECT TO_TIMESTAMP('2012-245','YYYY-DDD') FROM DUAL;
SELECT TO_TIMESTAMP('2012-245-8','YYYY-DDD-MM') FROM DUAL;
SELECT TO_TIMESTAMP('2012-245-9','YYYY-DDD-MM') FROM DUAL;
SELECT TO_TIMESTAMP('2012-245-1','YYYY-DDD-DD') FROM DUAL;
SELECT TO_TIMESTAMP('2012-245-2','YYYY-DDD-DD') FROM DUAL;
SELECT TO_TIMESTAMP('2012-245','YYYY-DDD');
SELECT TO_TIMESTAMP('2012-245-8','YYYY-DDD-MM');
SELECT TO_TIMESTAMP('2012-245-9','YYYY-DDD-MM');
SELECT TO_TIMESTAMP('2012-245-1','YYYY-DDD-DD');
SELECT TO_TIMESTAMP('2012-245-2','YYYY-DDD-DD');
--MS
SELECT TO_TIMESTAMP('-1','MS') FROM DUAL;
SELECT TO_TIMESTAMP('0','MS') FROM DUAL;
SELECT TO_TIMESTAMP('256','MS') FROM DUAL;
SELECT TO_TIMESTAMP('999','MS') FROM DUAL;
SELECT TO_TIMESTAMP('1000','MS') FROM DUAL;
SELECT TO_TIMESTAMP('-1','MS');
SELECT TO_TIMESTAMP('0','MS');
SELECT TO_TIMESTAMP('256','MS');
SELECT TO_TIMESTAMP('999','MS');
SELECT TO_TIMESTAMP('1000','MS');
--WW
SELECT TO_TIMESTAMP('0','WW') FROM DUAL;
SELECT TO_TIMESTAMP('1','WW') FROM DUAL;
SELECT TO_TIMESTAMP('10','WW') FROM DUAL;
SELECT TO_TIMESTAMP('53','WW') FROM DUAL;
SELECT TO_TIMESTAMP('54','WW') FROM DUAL;
SELECT TO_TIMESTAMP('0','WW');
SELECT TO_TIMESTAMP('1','WW');
SELECT TO_TIMESTAMP('10','WW');
SELECT TO_TIMESTAMP('53','WW');
SELECT TO_TIMESTAMP('54','WW');
--D
SELECT TO_TIMESTAMP('0','D') FROM DUAL;
SELECT TO_TIMESTAMP('1','D') FROM DUAL;
SELECT TO_TIMESTAMP('4','D') FROM DUAL;
SELECT TO_TIMESTAMP('7','D') FROM DUAL;
SELECT TO_TIMESTAMP('8','D') FROM DUAL;
SELECT TO_TIMESTAMP('0','D');
SELECT TO_TIMESTAMP('1','D');
SELECT TO_TIMESTAMP('4','D');
SELECT TO_TIMESTAMP('7','D');
SELECT TO_TIMESTAMP('8','D');
--WW & D YYYY
SELECT TO_TIMESTAMP('2012-50-0','YYYY-WW-D') FROM DUAL;
SELECT TO_TIMESTAMP('2012-50-1','YYYY-WW-D') FROM DUAL;
SELECT TO_TIMESTAMP('2012-50-4','YYYY-WW-D') FROM DUAL;
SELECT TO_TIMESTAMP('2012-50-7','YYYY-WW-D') FROM DUAL;
SELECT TO_TIMESTAMP('2012-50-8','YYYY-WW-D') FROM DUAL;
SELECT TO_TIMESTAMP('2012-0-4','YYYY-WW-D') FROM DUAL;
SELECT TO_TIMESTAMP('2012-1-4','YYYY-WW-D') FROM DUAL;
SELECT TO_TIMESTAMP('2012-50-4','YYYY-WW-D') FROM DUAL;
SELECT TO_TIMESTAMP('2012-53-4','YYYY-WW-D') FROM DUAL;
SELECT TO_TIMESTAMP('2012-54-4','YYYY-WW-D') FROM DUAL;
SELECT TO_TIMESTAMP('2012-50-0','YYYY-WW-D');
SELECT TO_TIMESTAMP('2012-50-1','YYYY-WW-D');
SELECT TO_TIMESTAMP('2012-50-4','YYYY-WW-D');
SELECT TO_TIMESTAMP('2012-50-7','YYYY-WW-D');
SELECT TO_TIMESTAMP('2012-50-8','YYYY-WW-D');
SELECT TO_TIMESTAMP('2012-0-4','YYYY-WW-D');
SELECT TO_TIMESTAMP('2012-1-4','YYYY-WW-D');
SELECT TO_TIMESTAMP('2012-50-4','YYYY-WW-D');
SELECT TO_TIMESTAMP('2012-53-4','YYYY-WW-D');
SELECT TO_TIMESTAMP('2012-54-4','YYYY-WW-D');
--US
SELECT TO_TIMESTAMP('-1','US') FROM DUAL;
SELECT TO_TIMESTAMP('0','US') FROM DUAL;
SELECT TO_TIMESTAMP('99999','US') FROM DUAL;
SELECT TO_TIMESTAMP('999999','US') FROM DUAL;
SELECT TO_TIMESTAMP('1000000','US') FROM DUAL;
SELECT TO_TIMESTAMP('-1','US');
SELECT TO_TIMESTAMP('0','US');
SELECT TO_TIMESTAMP('99999','US');
SELECT TO_TIMESTAMP('999999','US');
SELECT TO_TIMESTAMP('1000000','US');
--W
SELECT TO_TIMESTAMP('-1','W') FROM DUAL;
SELECT TO_TIMESTAMP('0','W') FROM DUAL;
SELECT TO_TIMESTAMP('1','W') FROM DUAL;
SELECT TO_TIMESTAMP('5','W') FROM DUAL;
SELECT TO_TIMESTAMP('6','W') FROM DUAL;
SELECT TO_TIMESTAMP('-1','W');
SELECT TO_TIMESTAMP('0','W');
SELECT TO_TIMESTAMP('1','W');
SELECT TO_TIMESTAMP('5','W');
SELECT TO_TIMESTAMP('6','W');
SHOW nls_timestamp_format;
SELECT TO_TIMESTAMP('01') FROM DUAL;
SELECT TO_TIMESTAMP('01-Sep') FROM DUAL;
SELECT TO_TIMESTAMP('01-Sep-1998') FROM DUAL;
SELECT TO_TIMESTAMP('01-Sep-1998 11') FROM DUAL;
SELECT TO_TIMESTAMP('01-Sep-1998 11:12') FROM DUAL;
SELECT TO_TIMESTAMP('01-Sep-1998 11:12:13') FROM DUAL;
SELECT TO_TIMESTAMP('01-Sep-1998 11:12:13.12') FROM DUAL;
SELECT TO_TIMESTAMP('01-Sep-1998 11:12:13.12 PM') FROM DUAL;
SELECT TO_TIMESTAMP('01-Sep-1998 11:12:13 PM') FROM DUAL;
SELECT TO_TIMESTAMP('01');
SELECT TO_TIMESTAMP('01-Sep');
SELECT TO_TIMESTAMP('01-Sep-1998');
SELECT TO_TIMESTAMP('01-Sep-1998 11');
SELECT TO_TIMESTAMP('01-Sep-1998 11:12');
SELECT TO_TIMESTAMP('01-Sep-1998 11:12:13');
SELECT TO_TIMESTAMP('01-Sep-1998 11:12:13.12');
SELECT TO_TIMESTAMP('01-Sep-1998 11:12:13.12 PM');
SELECT TO_TIMESTAMP('01-Sep-1998 11:12:13 PM');
SET nls_timestamp_format = 'YYYY-MM-DD HH:MI:SS.FF AM';
SHOW nls_timestamp_format;
SELECT TO_TIMESTAMP('1998') FROM DUAL;
SELECT TO_TIMESTAMP('1998-12-28') FROM DUAL;
SELECT TO_TIMESTAMP('1998-12-28 01') FROM DUAL;
SELECT TO_TIMESTAMP('1998-12-28 01:02') FROM DUAL;
SELECT TO_TIMESTAMP('1998-12-28 01:02:03') FROM DUAL;
SELECT TO_TIMESTAMP('1998-12-28 01:02:03.12') FROM DUAL;
SELECT TO_TIMESTAMP('1998-12-28 01:02:03.12 AM') FROM DUAL;
SELECT TO_TIMESTAMP('1998-12-28 11:12:13 PM') FROM DUAL;
SELECT TO_TIMESTAMP('01') FROM DUAL;
select to_date('2018--12;30', 'yyyy//mm/,,dd') from dual;
select to_date('2018-12 30', 'yyyy//mm/dd') from dual;
SELECT TO_TIMESTAMP('1998');
SELECT TO_TIMESTAMP('1998-12-28');
SELECT TO_TIMESTAMP('1998-12-28 01');
SELECT TO_TIMESTAMP('1998-12-28 01:02');
SELECT TO_TIMESTAMP('1998-12-28 01:02:03');
SELECT TO_TIMESTAMP('1998-12-28 01:02:03.12');
SELECT TO_TIMESTAMP('1998-12-28 01:02:03.12 AM');
SELECT TO_TIMESTAMP('1998-12-28 11:12:13 PM');
SELECT TO_TIMESTAMP('01');
select to_date('2018--12;30', 'yyyy//mm/,,dd');
select to_date('2018-12 30', 'yyyy//mm/dd');
select to_date('20181231124559','yyyy-MM-dd hh24:mi:ss');
SELECT (TO_DATE('1999(12*23 12 26','yyyy-MM-dd hh24:mi:ss')) FROM dual;
SELECT (TO_DATE('1999(12*23 12 26','yyyy-MM-dd hh24:mi:ss')) FROM dual;
SELECT (TO_DATE('1999(12*23 12 26','yyyy-MM-dd hh24:mi:ss'));
SELECT (TO_DATE('1999(12*23 12 26','yyyy-MM-dd hh24:mi:ss'));
SELECT (TO_DATE('1999(12*23 12
26','yyyy-MM-dd hh24:mi:ss')) FROM dual;
26','yyyy-MM-dd hh24:mi:ss'));
SELECT to_date('10', 'SSSSS');
SELECT TO_TIMESTAMP('01', 'yyyy-MM-dd') FROM DUAL;
SELECT TO_CHAR(TO_DATE('27OCT17', 'DDMONRR') ,'YYYY') "Year" FROM DUAL;
SELECT TO_CHAR(TO_DATE('27-OCT98', 'DD-MON-RR') ,'YYYY') "Year" FROM DUAL;
SELECT TO_CHAR(TO_DATE('27DEC98', 'DDMON-RR') ,'MON') "Month" FROM DUAL;
SELECT TO_CHAR(TO_DATE('27/OCT/17', 'DD-MON-RR') ,'DD') "Year" FROM DUAL;
SELECT TO_TIMESTAMP('01', 'yyyy-MM-dd');
SELECT TO_CHAR(TO_DATE('27OCT17', 'DDMONRR') ,'YYYY') "Year";
SELECT TO_CHAR(TO_DATE('27-OCT98', 'DD-MON-RR') ,'YYYY') "Year";
SELECT TO_CHAR(TO_DATE('27DEC98', 'DDMON-RR') ,'MON') "Month";
SELECT TO_CHAR(TO_DATE('27/OCT/17', 'DD-MON-RR') ,'DD') "Year";
SELECT to_date('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 11111');
SELECT to_date('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 11111');

View File

@ -15,7 +15,7 @@ SELECT INTERVAL '1.5 weeks' AS "Ten days twelve hours";
SELECT INTERVAL '1.5 months' AS "One month 15 days";
SELECT INTERVAL '10 years -11 month -12 days +13:14' AS "9 years...";
--check interval concat null
SELECT '' || INTERVAL '10 years -11 month -12 days +13:14' AS "9 years..." from dual;
SELECT '' || INTERVAL '10 years -11 month -12 days +13:14' AS "9 years...";
CREATE TABLE INTERVAL_TBL (f1 interval);
@ -197,7 +197,7 @@ SELECT interval '1 2.3456' minute to second(2);
SELECT interval '1 2:03.5678' minute to second(2);
SELECT interval '1 2:03:04.5678' minute to second(2);
--check interval concat with null
SELECT interval '1 2:03:04.5678' minute to second(2) || '' from dual;
SELECT interval '1 2:03:04.5678' minute to second(2) || '';
-- test casting to restricted precision (bug #14479)
SELECT f1,

View File

@ -1,6 +1,6 @@
-- add test case into 'case DCH_RRRR' and 'case DCH_RR' in DCH_from_char function, then the function adjust_partial_year_to_current_year will covered:
select to_date('06-JAN-40 00:00:00','DD-MON-RRRR HH24:MI:SS') from dual;
select to_date('01/05/81','dd/mm/rr') from dual;
select to_date('06-JAN-40 00:00:00','DD-MON-RRRR HH24:MI:SS');
select to_date('01/05/81','dd/mm/rr');
-- add test case for float4_to_char function
select to_char(0.15::float4);

View File

@ -3,10 +3,10 @@ select pg_typeof('vasya'), 'vasya' is of (unknown);
explain (verbose on, costs off) select 1 where 'vasya' = (select 'vasya' as col1);
explain (verbose on, costs off) select 1 where 'vasya' = (select 'vasya' as col1 where col1 <> 'aaa');
explain (verbose on, costs off) select 1 where 'vasya' = (select 'vasya' as col1 from dual where col1 <> 'aaa');
explain (verbose on, costs off) select 1 where 'vasya' = (select 'vasya' as col1 where col1 <> 'aaa');
select 1 where 'vasya' = (select 'vasya' as col1);
select 1 where 'vasya' = (select 'vasya' as col1 where col1 <> 'aaa');
select 1 where 'vasya' = (select 'vasya' as col1 from dual where col1 <> 'aaa');
select 1 where 'vasya' = (select 'vasya' as col1 where col1 <> 'aaa');
explain (verbose on, costs off) select pg_typeof(col1), col1, col1 is of (unknown), col1 is of (text) from (select 'vasya' as col1) order by col1;
explain (verbose on, costs off) select pg_typeof(col1), col1, col1 is of (unknown), col1 is of (text) from (select 'vasya' as col1) group by col1;
@ -66,7 +66,7 @@ INSERT INTO test_unknown(a, b) VALUES (1, 'beijing');
INSERT INTO test_unknown(a, b) VALUES (1, 'beijing') LIMIT 1;
INSERT INTO test_unknown(a, b) VALUES (2, 'shenzhen'), (3, 'shanghai');
INSERT INTO test_unknown(a, b) VALUES (4, 'suzhou'), (5, 'hangzhou') ORDER BY 1 LIMIT 1;
INSERT INTO test_unknown(a, b) SELECT 6, 'xian' FROM DUAL;
INSERT INTO test_unknown(a, b) SELECT 6, 'xian';
TABLE test_unknown ORDER BY a;
TRUNCATE test_unknown;
@ -74,7 +74,7 @@ INSERT INTO test_unknown(a, b) VALUES (1, 'beijing');
INSERT INTO test_unknown(a, b) VALUES (1, 'beijing') LIMIT 1;
INSERT INTO test_unknown(a, b) VALUES (2, 'shenzhen'), (3, 'shanghai');
INSERT INTO test_unknown(a, b) VALUES (4, 'suzhou'), (5, 'hangzhou') ORDER BY 1 LIMIT 1;
INSERT INTO test_unknown(a, b) SELECT 6, 'xian' FROM DUAL;
INSERT INTO test_unknown(a, b) SELECT 6, 'xian';
TABLE test_unknown ORDER BY a;

View File

@ -86,8 +86,8 @@ select rownum, name from (select name from distributors where rownum <= 4 inters
--test group by
select rownum from distributors group by rownum;
select rownum rn from distributors group by rn;
select rownum + 1 from dual group by rownum;
select rownum + 1 rn from dual group by rn;
select rownum + 1 group by rownum;
select rownum + 1 rn group by rn;
--test having
select id from distributors group by rownum,id having rownum < 5;