更改fastcheck中,out文件空格导致失败问题

This commit is contained in:
zhang_xubo 2022-03-06 01:56:46 +08:00
parent 6a5266d02a
commit 1d1f529c89
11 changed files with 601 additions and 953 deletions

View File

@ -85,6 +85,11 @@ chmod a+x build_opengauss.sh
if [ "${wrap_binaries}"X = "YES"X ]
then
chmod a+x package_opengauss.sh
./package_opengauss.sh -3rd ${build_binarylib_dir} -m ${build_version_mode} -f ${config_file}
if [ X$config_file = "X" ];then
./package_opengauss.sh -3rd ${build_binarylib_dir} -m ${build_version_mode}
else
./package_opengauss.sh -3rd ${build_binarylib_dir} -m ${build_version_mode} -f ${config_file}
fi
fi
exit 0

View File

@ -1,5 +1,4 @@
-- FOR VARRAY INTERFACE --
-- check compatibility --
show sql_compatibility; -- expect A --
sql_compatibility
@ -7,13 +6,11 @@ show sql_compatibility; -- expect A --
A
(1 row)
-- create new schema --
drop schema if exists plpgsql_array_interface;
NOTICE: schema "plpgsql_array_interface" does not exist, skipping
create schema plpgsql_array_interface;
set current_schema = plpgsql_array_interface;
-- test array interface count --
create or replace procedure array_interface_p1()
as
@ -30,7 +27,6 @@ begin
raise NOTICE '%', colors1.count;
end;
/
call array_interface_p1();
NOTICE: {red,orange,NULL,NULL,green,blue,indigo,violet}
NOTICE: 8
@ -43,7 +39,6 @@ NOTICE: 13
(1 row)
-- test array interface count --
create or replace procedure array_interface_p2()
as
@ -63,7 +58,6 @@ begin
raise NOTICE '%', colors1;
end;
/
call array_interface_p2();
NOTICE: {red,orange,green,blue,indigo,violet}
NOTICE: {NULL,orange,green,NULL,indigo,NULL}
@ -74,7 +68,6 @@ NOTICE: {NULL,2,3,NULL,5,NULL,7,8}
(1 row)
-- test array interface exists --
create or replace procedure array_interface_p3()
as
@ -112,7 +105,6 @@ begin
end loop;
end;
/
call array_interface_p3();
NOTICE: --------------------colors--------------------------
NOTICE: {NULL,red,orange,NULL,green,NULL,blue,NULL,indigo,violet,NULL}
@ -207,7 +199,6 @@ NOTICE: ----------------
(1 row)
-- test array interface exists --
create or replace procedure array_interface_p4()
as
@ -245,7 +236,6 @@ begin
end loop;
end;
/
call array_interface_p4();
NOTICE: --------------------colors--------------------------
NOTICE: {1,2,NULL,3,4,NULL,5,6,7,8}
@ -344,7 +334,6 @@ NOTICE: ----------------
(1 row)
-- test array interface first and last --
create or replace procedure array_interface_p5()
as
@ -383,7 +372,6 @@ begin
raise NOTICE 'colors4 last: %', colors4[colors4.last];
end;
/
call array_interface_p5();
NOTICE: ---------colors1---------
NOTICE: {red,orange,NULL,green,NULL,blue}
@ -414,7 +402,6 @@ NOTICE: colors4 last: <NULL>
(1 row)
-- next&prior
create or replace procedure array_interface_p6()
as
@ -460,7 +447,6 @@ begin
end loop;
end;
/
call array_interface_p6();
NOTICE: --------------------colors1---------------------
NOTICE: {red,orange,NULL,green,blue,NULL,indigo,violet}
@ -653,7 +639,6 @@ NOTICE: -------
(1 row)
-- test empty array exists interface return
create or replace procedure array_interface_p7()
as
@ -674,7 +659,6 @@ begin
raise NOTICE 'colors2["%"] exists return %', vi, colors2.exists(vi);
end;
/
call array_interface_p7();
NOTICE: colors1 is {}
NOTICE: colors2 is {}
@ -687,7 +671,6 @@ NOTICE: colors2["43243442"] exists return f
(1 row)
-- test array exists interface string input parameter
create or replace procedure array_interface_p8()
as
@ -703,9 +686,7 @@ end;
/
ERROR: schema "colors" does not exist
CONTEXT: compilation of PL/pgSQL function "array_interface_p8" near line 7
--call array_interface_p8();
-- test array exists interface A.B input parameter
create or replace procedure array_interface_p9()
as
@ -734,7 +715,6 @@ begin
end loop;
end;
/
call array_interface_p9();
NOTICE: v_a is {}
NOTICE: v_a[1] is not exist
@ -763,7 +743,6 @@ NOTICE: v_a[10] is exist
(1 row)
create or replace procedure array_interface_p10() as
declare
colors varchar2[];
@ -781,7 +760,6 @@ begin
end if;
end;
/
call array_interface_p10();
NOTICE: array exist, element is orange
NOTICE: array exist, element is c12
@ -790,7 +768,6 @@ NOTICE: array exist, element is c12
(1 row)
create or replace procedure array_interface_p11() as
declare
colors varchar2[];
@ -808,7 +785,6 @@ begin
end if;
end;
/
call array_interface_p11();
NOTICE: array exist, element is orange
NOTICE: array exist, element is c12
@ -817,7 +793,6 @@ NOTICE: array exist, element is c12
(1 row)
create or replace procedure array_interface_p12() as
declare
colors varchar2[];
@ -856,7 +831,6 @@ begin
raise NOTICE '%', colors;
end;
/
call array_interface_p12();
NOTICE: {red,orange,yellow,green,blue,indigo,violet}
NOTICE: 7
@ -904,8 +878,6 @@ NOTICE: {}
(1 row)
-- clean up --
drop schema if exists plpgsql_array_interface cascade;
NOTICE: drop cascades to 11 other objects

View File

@ -1,5 +1,4 @@
-- FOR VARRAY INTERFACE --
-- check compatibility --
show sql_compatibility;
sql_compatibility
@ -12,7 +11,6 @@ drop schema if exists plpgsql_array_interface_ted;
NOTICE: schema "plpgsql_array_interface_ted" does not exist, skipping
create schema plpgsql_array_interface_ted;
set current_schema = plpgsql_array_interface_ted;
-- test array interface extend trim and delete --
create or replace procedure array_interface_p1()
as
@ -33,7 +31,6 @@ begin
raise NOTICE'%',colors1;
end;
/
call array_interface_p1();
NOTICE: {red,orange,NULL,blue}
NOTICE: {red,orange,NULL,blue,NULL,NULL}
@ -45,7 +42,6 @@ NOTICE: {}
(1 row)
-- test array interface extend trim and delete --
create or replace procedure array_interface_p1()
as
@ -66,7 +62,6 @@ begin
raise NOTICE'%',colors1;
end;
/
call array_interface_p1();
NOTICE: {red}
NOTICE: {red,NULL,NULL,NULL,NULL}
@ -78,7 +73,6 @@ NOTICE: {}
(1 row)
-- test array interface extend mistake format --
create or replace procedure array_interface_p1()
as
@ -105,9 +99,7 @@ begin
colors.extend[-1];
raise NOTICE'%',colors;
end
--call array_interface_p1();
-- test array interface trim mistake format --
create or replace procedure array_interface_p1()
as
@ -134,9 +126,7 @@ begin
colors.trim[-1];
raise NOTICE'%',colors;
end
--call array_interface_p1();
-- test array interface delete mistake format --
create or replace procedure array_interface_p1()
as
@ -183,9 +173,7 @@ begin
colors4.delete[-1];
raise NOTICE'%',colors4;
end
--call array_interface_p1();
-- test array name use special character --
create or replace procedure array_interface_p1()
as
@ -202,7 +190,6 @@ begin
raise NOTICE '%',"@*ar&";
end;
/
call array_interface_p1();
NOTICE: {red,orange,green,blue,indigo}
NOTICE: {red,orange,green,blue,indigo,NULL,NULL,NULL}
@ -213,7 +200,6 @@ NOTICE: {}
(1 row)
-- test array name use special character mistake --
create or replace procedure array_interface_p1()
as
@ -236,9 +222,7 @@ begin
@*ar&.extend(3);
raise NOTICE'%',@*ar&;
end
-- call array_interface_p1();
-- test array interface extend with large parameter --
create or replace procedure array_interface_p1()
as
@ -250,7 +234,6 @@ begin
raise NOTICE'%',arr.count;
end;
/
call array_interface_p1();
NOTICE: {1,0,5,6,8,3,9}
NOTICE: 10007
@ -259,7 +242,6 @@ NOTICE: 10007
(1 row)
-- test array interface trim --
create or replace procedure array_interface_p1()
as
@ -271,7 +253,6 @@ begin
raise NOTICE'%',arr;
end;
/
call array_interface_p1();
NOTICE: {1,0,5}
NOTICE: {}
@ -280,7 +261,6 @@ NOTICE: {}
(1 row)
-- test array interface delete with empty array --
create or replace procedure array_interface_p1()
as
@ -292,7 +272,6 @@ begin
raise NOTICE'%',arr;
end;
/
call array_interface_p1();
NOTICE: {}
NOTICE: {}
@ -301,7 +280,6 @@ NOTICE: {}
(1 row)
-- test array interface delete missing ; --
create or replace procedure array_interface_p1()
as
@ -324,19 +302,16 @@ begin
colors.delete
raise NOTICE'%',colors;
end
-- test call array interface of another package
create or replace package pck1 is
type ta is varray(10) of varchar(100);
tb ta := ta('1','2','3', '4', '5');
end pck1;
/
create or replace package pck2 is
procedure proc1;
end pck2;
/
create or replace package body pck2 is
procedure proc1() is
begin
@ -376,7 +351,6 @@ begin
end;
end pck2;
/
call pck2.proc1();
NOTICE: {1,2,3,4,5}
NOTICE: 5
@ -404,7 +378,6 @@ NOTICE: {}
(1 row)
-- test array interface delete with index --
create or replace procedure array_interface_p1() as
declare
@ -436,7 +409,6 @@ begin
raise NOTICE '%', array1.last;
end;
/
call array_interface_p1();
NOTICE: {1,2,3,4,5}
NOTICE: 5
@ -459,7 +431,6 @@ NOTICE: 4
(1 row)
-- clean up --
drop package if exists pck2;
NOTICE: drop cascades to function plpgsql_array_interface_ted.proc1()

View File

@ -1,23 +1,25 @@
-- section 1: test from delete.sql
create table delete_test_hash (
id int,
a int,
b text
) partition by hash(a)
(
partition delete_test_hash_p1,
partition delete_test_hash_p2,
partition delete_test_hash_p3);
create index delete_test_hash_index_local1 on delete_test_hash (a) local
(
partition delete_test_hash_p1_index_local tablespace PG_DEFAULT,
partition delete_test_hash_p2_index_local tablespace PG_DEFAULT,
partition delete_test_hash_p3_index_local tablespace PG_DEFAULT
);
INSERT INTO delete_test_hash (a) VALUES (10);
INSERT INTO delete_test_hash (a, b) VALUES (50, repeat('x', 10000));
INSERT INTO delete_test_hash (a) VALUES (100);
SELECT id, a, char_length(b) FROM delete_test_hash order by 1, 2, 3;
-- section 1: test from delete.sql
create table delete_test_hash (
id int,
a int,
b text
) partition by hash(a)
(
partition delete_test_hash_p1,
partition delete_test_hash_p2,
partition delete_test_hash_p3);
create index delete_test_hash_index_local1 on delete_test_hash (a) local
(
partition delete_test_hash_p1_index_local tablespace PG_DEFAULT,
partition delete_test_hash_p2_index_local tablespace PG_DEFAULT,
partition delete_test_hash_p3_index_local tablespace PG_DEFAULT
);
INSERT INTO delete_test_hash (a) VALUES (10);
INSERT INTO delete_test_hash (a, b) VALUES (50, repeat('x', 10000));
INSERT INTO delete_test_hash (a) VALUES (100);
SELECT id, a, char_length(b) FROM delete_test_hash order by 1, 2, 3;
id | a | char_length
----+-----+-------------
| 10 |
@ -25,80 +27,91 @@ SELECT id, a, char_length(b) FROM delete_test_hash order by 1, 2, 3;
| 100 |
(3 rows)
-- Pseudo Constant Quals
DELETE FROM delete_test_hash where null;
-- allow an alias to be specified for DELETE's target table
DELETE FROM delete_test_hash AS dt WHERE dt.a > 75;
-- if an alias is specified, don't allow the original table name
-- to be referenced
DELETE FROM delete_test_hash dt WHERE dt.a > 25;
SELECT id, a, char_length(b) FROM delete_test_hash order by 1, 2, 3;
-- Pseudo Constant Quals
DELETE FROM delete_test_hash where null;
-- allow an alias to be specified for DELETE's target table
DELETE FROM delete_test_hash AS dt WHERE dt.a > 75;
-- if an alias is specified, don't allow the original table name
-- to be referenced
DELETE FROM delete_test_hash dt WHERE dt.a > 25;
SELECT id, a, char_length(b) FROM delete_test_hash order by 1, 2, 3;
id | a | char_length
----+----+-------------
| 10 |
(1 row)
-- delete a row with a TOASTed value
DELETE FROM delete_test_hash WHERE a > 25;
SELECT id, a, char_length(b) FROM delete_test_hash order by 1, 2, 3;
-- delete a row with a TOASTed value
DELETE FROM delete_test_hash WHERE a > 25;
SELECT id, a, char_length(b) FROM delete_test_hash order by 1, 2, 3;
id | a | char_length
----+----+-------------
| 10 |
(1 row)
DROP TABLE delete_test_hash;
-- section 2:
create table hw_hash_partition_dml_t1 (id int, name text)partition by hash(id) (
partition hw_hash_partition_dml_t1_p1,
partition hw_hash_partition_dml_t1_p2,
partition hw_hash_partition_dml_t1_p3);
create index hw_hash_partition_dml_t1_index_local1 on hw_hash_partition_dml_t1(id) local
(
partition hw_hash_partition_dml_t1_p1_index_local_1 tablespace PG_DEFAULT,
partition hw_hash_partition_dml_t1_p2_index_local_1 tablespace PG_DEFAULT,
partition hw_hash_partition_dml_t1_p3_index_local_1 tablespace PG_DEFAULT
);
create table hw_hash_partition_dml_t2 (id int, name text)partition by hash(id) (
partition hw_hash_partition_dml_t2_p1,
partition hw_hash_partition_dml_t2_p2,
partition hw_hash_partition_dml_t2_p3);
create table hw_hash_partition_dml_t3 (id int, name text)partition by hash(id) (
partition hw_hash_partition_dml_t3_p1,
partition hw_hash_partition_dml_t3_p2,
partition hw_hash_partition_dml_t3_p3);
-- section 2.1: two table join, both are partitioned table
insert into hw_hash_partition_dml_t1 values (1, 'li'), (11, 'wang'), (21, 'zhang');
insert into hw_hash_partition_dml_t2 values (1, 'xi'), (11, 'zhao'), (27, 'qi');
insert into hw_hash_partition_dml_t3 values (1, 'qin'), (11, 'he'), (27, 'xiao');
-- delete 10~20 tupes in hw_partition_dml_t1
with T2_ID_10TH AS
(
SELECT id
FROM hw_hash_partition_dml_t2
WHERE id >= 10 and id < 20
ORDER BY id
)
delete from hw_hash_partition_dml_t1
using hw_hash_partition_dml_t2
where hw_hash_partition_dml_t1.id < hw_hash_partition_dml_t2.id
and hw_hash_partition_dml_t2.id IN
(SELECT id FROM T2_ID_10TH)
RETURNING hw_hash_partition_dml_t1.name;
DROP TABLE delete_test_hash;
-- section 2:
create table hw_hash_partition_dml_t1 (id int, name text)partition by hash(id) (
partition hw_hash_partition_dml_t1_p1,
partition hw_hash_partition_dml_t1_p2,
partition hw_hash_partition_dml_t1_p3);
create index hw_hash_partition_dml_t1_index_local1 on hw_hash_partition_dml_t1(id) local
(
partition hw_hash_partition_dml_t1_p1_index_local_1 tablespace PG_DEFAULT,
partition hw_hash_partition_dml_t1_p2_index_local_1 tablespace PG_DEFAULT,
partition hw_hash_partition_dml_t1_p3_index_local_1 tablespace PG_DEFAULT
);
create table hw_hash_partition_dml_t2 (id int, name text)partition by hash(id) (
partition hw_hash_partition_dml_t2_p1,
partition hw_hash_partition_dml_t2_p2,
partition hw_hash_partition_dml_t2_p3);
create table hw_hash_partition_dml_t3 (id int, name text)partition by hash(id) (
partition hw_hash_partition_dml_t3_p1,
partition hw_hash_partition_dml_t3_p2,
partition hw_hash_partition_dml_t3_p3);
-- section 2.1: two table join, both are partitioned table
insert into hw_hash_partition_dml_t1 values (1, 'li'), (11, 'wang'), (21, 'zhang');
insert into hw_hash_partition_dml_t2 values (1, 'xi'), (11, 'zhao'), (27, 'qi');
insert into hw_hash_partition_dml_t3 values (1, 'qin'), (11, 'he'), (27, 'xiao');
-- delete 10~20 tupes in hw_partition_dml_t1
with T2_ID_10TH AS
(
SELECT id
FROM hw_hash_partition_dml_t2
WHERE id >= 10 and id < 20
ORDER BY id
)
delete from hw_hash_partition_dml_t1
using hw_hash_partition_dml_t2
where hw_hash_partition_dml_t1.id < hw_hash_partition_dml_t2.id
and hw_hash_partition_dml_t2.id IN
(SELECT id FROM T2_ID_10TH)
RETURNING hw_hash_partition_dml_t1.name;
name
------
li
(1 row)
select * from hw_hash_partition_dml_t1 order by 1, 2;
select * from hw_hash_partition_dml_t1 order by 1, 2;
id | name
----+-------
11 | wang
21 | zhang
(2 rows)
-- delete all tupes that is less than 11 in hw_hash_partition_dml_t1, that is 3
insert into hw_hash_partition_dml_t1 values (3, 'AAA'), (13, 'BBB'), (23, 'CCC'), (24, 'DDD');
select * from hw_hash_partition_dml_t1 order by 1, 2;
-- delete all tupes that is less than 11 in hw_hash_partition_dml_t1, that is 3
insert into hw_hash_partition_dml_t1 values (3, 'AAA'), (13, 'BBB'), (23, 'CCC'), (24, 'DDD');
select * from hw_hash_partition_dml_t1 order by 1, 2;
id | name
----+-------
3 | AAA
@ -109,13 +122,13 @@ select * from hw_hash_partition_dml_t1 order by 1, 2;
24 | DDD
(6 rows)
delete from hw_hash_partition_dml_t1 using hw_hash_partition_dml_t2 where hw_hash_partition_dml_t1.id < hw_hash_partition_dml_t2.id and hw_hash_partition_dml_t2.id = 11 RETURNING hw_hash_partition_dml_t1.id;
delete from hw_hash_partition_dml_t1 using hw_hash_partition_dml_t2 where hw_hash_partition_dml_t1.id < hw_hash_partition_dml_t2.id and hw_hash_partition_dml_t2.id = 11 RETURNING hw_hash_partition_dml_t1.id;
id
----
3
(1 row)
select * from hw_hash_partition_dml_t1 order by 1, 2;
select * from hw_hash_partition_dml_t1 order by 1, 2;
id | name
----+-------
11 | wang
@ -125,19 +138,21 @@ select * from hw_hash_partition_dml_t1 order by 1, 2;
24 | DDD
(5 rows)
-- section 2.2: delete from only one table, no joining
-- delete all tupes remaining: 13, 23, 24
delete from hw_hash_partition_dml_t1;
select * from hw_hash_partition_dml_t1 order by 1, 2;
-- section 2.2: delete from only one table, no joining
-- delete all tupes remaining: 13, 23, 24
delete from hw_hash_partition_dml_t1;
select * from hw_hash_partition_dml_t1 order by 1, 2;
id | name
----+------
(0 rows)
-- section 3:
-- section 3.1: two table join, only one is partitioned table
-- and target relation is partitioned
insert into hw_hash_partition_dml_t1 values (1, 'AAA'), (11, 'BBB'), (21, 'CCC');
select * from hw_hash_partition_dml_t1 order by 1, 2;
-- section 3:
-- section 3.1: two table join, only one is partitioned table
-- and target relation is partitioned
insert into hw_hash_partition_dml_t1 values (1, 'AAA'), (11, 'BBB'), (21, 'CCC');
select * from hw_hash_partition_dml_t1 order by 1, 2;
id | name
----+------
1 | AAA
@ -145,16 +160,16 @@ select * from hw_hash_partition_dml_t1 order by 1, 2;
21 | CCC
(3 rows)
-- delete all tupes in hw_hash_partition_dml_t1
delete from hw_hash_partition_dml_t1 using hw_hash_partition_dml_t3 where hw_hash_partition_dml_t1.id < hw_hash_partition_dml_t3.id and hw_hash_partition_dml_t3.id = 27;
select * from hw_hash_partition_dml_t1 order by 1, 2;
-- delete all tupes in hw_hash_partition_dml_t1
delete from hw_hash_partition_dml_t1 using hw_hash_partition_dml_t3 where hw_hash_partition_dml_t1.id < hw_hash_partition_dml_t3.id and hw_hash_partition_dml_t3.id = 27;
select * from hw_hash_partition_dml_t1 order by 1, 2;
id | name
----+------
(0 rows)
-- delete all tupes that is less than 11 in hw_hash_partition_dml_t1, that is 3
insert into hw_hash_partition_dml_t1 values (3, 'AAA'), (13, 'BBB'), (23, 'CCC'), (24, 'DDD');
select * from hw_hash_partition_dml_t1 order by 1, 2;
-- delete all tupes that is less than 11 in hw_hash_partition_dml_t1, that is 3
insert into hw_hash_partition_dml_t1 values (3, 'AAA'), (13, 'BBB'), (23, 'CCC'), (24, 'DDD');
select * from hw_hash_partition_dml_t1 order by 1, 2;
id | name
----+------
3 | AAA
@ -163,8 +178,8 @@ select * from hw_hash_partition_dml_t1 order by 1, 2;
24 | DDD
(4 rows)
delete from hw_hash_partition_dml_t1 using hw_hash_partition_dml_t3 where hw_hash_partition_dml_t1.id < hw_hash_partition_dml_t3.id and hw_hash_partition_dml_t3.id = 11;
select * from hw_hash_partition_dml_t1 order by 1, 2;
delete from hw_hash_partition_dml_t1 using hw_hash_partition_dml_t3 where hw_hash_partition_dml_t1.id < hw_hash_partition_dml_t3.id and hw_hash_partition_dml_t3.id = 11;
select * from hw_hash_partition_dml_t1 order by 1, 2;
id | name
----+------
13 | BBB
@ -172,19 +187,21 @@ select * from hw_hash_partition_dml_t1 order by 1, 2;
24 | DDD
(3 rows)
-- section 3.2 delete from only one table, no joining
-- delete all tupes remaining: 13, 23, 24
delete from hw_hash_partition_dml_t1;
select * from hw_hash_partition_dml_t1 order by 1, 2;
-- section 3.2 delete from only one table, no joining
-- delete all tupes remaining: 13, 23, 24
delete from hw_hash_partition_dml_t1;
select * from hw_hash_partition_dml_t1 order by 1, 2;
id | name
----+------
(0 rows)
-- section 3.3: two table join, only one is partitioned table
-- and target relation is on-partitioned
-- delete all tuples in hw_hash_partition_dml_t3
insert into hw_hash_partition_dml_t2 values (28, 'EEE');
select * from hw_hash_partition_dml_t3;
-- section 3.3: two table join, only one is partitioned table
-- and target relation is on-partitioned
-- delete all tuples in hw_hash_partition_dml_t3
insert into hw_hash_partition_dml_t2 values (28, 'EEE');
select * from hw_hash_partition_dml_t3;
id | name
----+------
27 | xiao
@ -192,7 +209,7 @@ select * from hw_hash_partition_dml_t3;
1 | qin
(3 rows)
select * from hw_hash_partition_dml_t2;
select * from hw_hash_partition_dml_t2;
id | name
----+------
27 | qi
@ -201,16 +218,17 @@ select * from hw_hash_partition_dml_t2;
28 | EEE
(4 rows)
delete from hw_hash_partition_dml_t3 using hw_hash_partition_dml_t2 where hw_hash_partition_dml_t3.id < hw_hash_partition_dml_t2.id and hw_hash_partition_dml_t2.id = 28;
select * from hw_hash_partition_dml_t3 order by 1, 2;
delete from hw_hash_partition_dml_t3 using hw_hash_partition_dml_t2 where hw_hash_partition_dml_t3.id < hw_hash_partition_dml_t2.id and hw_hash_partition_dml_t2.id = 28;
select * from hw_hash_partition_dml_t3 order by 1, 2;
id | name
----+------
(0 rows)
-- delete all tuples that is less than 11 in hw_hash_partition_dml_t3, that is 3
insert into hw_hash_partition_dml_t3 values (3, 'AAA'), (13, 'BBB'), (23, 'CCC'), (24, 'DDD');
delete from hw_hash_partition_dml_t3 using hw_hash_partition_dml_t2 where hw_hash_partition_dml_t3.id < hw_hash_partition_dml_t2.id and hw_hash_partition_dml_t2.id = 11;
select * from hw_hash_partition_dml_t3 order by 1, 2;
-- delete all tuples that is less than 11 in hw_hash_partition_dml_t3, that is 3
insert into hw_hash_partition_dml_t3 values (3, 'AAA'), (13, 'BBB'), (23, 'CCC'), (24, 'DDD');
delete from hw_hash_partition_dml_t3 using hw_hash_partition_dml_t2 where hw_hash_partition_dml_t3.id < hw_hash_partition_dml_t2.id and hw_hash_partition_dml_t2.id = 11;
select * from hw_hash_partition_dml_t3 order by 1, 2;
id | name
----+------
13 | BBB
@ -218,46 +236,50 @@ select * from hw_hash_partition_dml_t3 order by 1, 2;
24 | DDD
(3 rows)
-- section 3.4 delete from only one table, no joining
-- delete all tuples remaining: 13, 23, 24
delete from hw_hash_partition_dml_t3;
select * from hw_hash_partition_dml_t3 order by 1, 2;
-- section 3.4 delete from only one table, no joining
-- delete all tuples remaining: 13, 23, 24
delete from hw_hash_partition_dml_t3;
select * from hw_hash_partition_dml_t3 order by 1, 2;
id | name
----+------
(0 rows)
-- finally, drop table hw_hash_partition_dml_t1, hw_hash_partition_dml_t2 and hw_hash_partition_dml_t3
drop table hw_hash_partition_dml_t1;
drop table hw_hash_partition_dml_t2;
drop table hw_hash_partition_dml_t3;
create schema fvt_other_cmd;
CREATE TABLE FVT_OTHER_CMD.IDEX_LIST_PARTITION_TABLE_001(COL_INT int)
partition by hash (COL_INT)
(
partition IDEX_LIST_PARTITION_TABLE_001_1,
partition IDEX_LIST_PARTITION_TABLE_001_2,
partition IDEX_LIST_PARTITION_TABLE_001_3
);
declare
i int;
begin i:=1;
while
i<19990 LOOP
Delete from FVT_OTHER_CMD.IDEX_LIST_PARTITION_TABLE_001 where col_int=i;
i:=i+100;
end loop;
end;
/
drop table test_index_ht;
-- finally, drop table hw_hash_partition_dml_t1, hw_hash_partition_dml_t2 and hw_hash_partition_dml_t3
drop table hw_hash_partition_dml_t1;
drop table hw_hash_partition_dml_t2;
drop table hw_hash_partition_dml_t3;
create schema fvt_other_cmd;
CREATE TABLE FVT_OTHER_CMD.IDEX_LIST_PARTITION_TABLE_001(COL_INT int)
partition by hash (COL_INT)
(
partition IDEX_LIST_PARTITION_TABLE_001_1,
partition IDEX_LIST_PARTITION_TABLE_001_2,
partition IDEX_LIST_PARTITION_TABLE_001_3
);
declare
i int;
begin i:=1;
while
i<19990 LOOP
Delete from FVT_OTHER_CMD.IDEX_LIST_PARTITION_TABLE_001 where col_int=i;
i:=i+100;
end loop;
end;
/
drop table test_index_ht;
ERROR: table "test_index_ht" does not exist
create table test_index_ht (a int, b int, c int)
partition by hash(a)
(
PARTITION p1,
PARTITION p2
);
insert into test_index_ht select generate_series(3,6);
explain (costs off, verbose on) select * from test_index_ht order by 1;
create table test_index_ht (a int, b int, c int)
partition by hash(a)
(
PARTITION p1,
PARTITION p2
);
insert into test_index_ht select generate_series(3,6);
explain (costs off, verbose on) select * from test_index_ht order by 1;
QUERY PLAN
----------------------------------------------------------
Sort
@ -271,7 +293,7 @@ explain (costs off, verbose on) select * from test_index_ht order by 1;
Selected Partitions: 1..2
(9 rows)
select * from test_index_ht order by 1;
select * from test_index_ht order by 1;
a | b | c
---+---+---
3 | |
@ -280,10 +302,10 @@ select * from test_index_ht order by 1;
6 | |
(4 rows)
create index test_exchange_index_lt_ha on test_index_ht (a) local;
set enable_seqscan = off;
set enable_bitmapscan = off;
explain (costs off, verbose on) select * from test_index_ht order by 1;
create index test_exchange_index_lt_ha on test_index_ht (a) local;
set enable_seqscan = off;
set enable_bitmapscan = off;
explain (costs off, verbose on) select * from test_index_ht order by 1;
QUERY PLAN
--------------------------------------------------------------------------------------------
Sort
@ -297,7 +319,7 @@ explain (costs off, verbose on) select * from test_index_ht order by 1;
Selected Partitions: 1..2
(9 rows)
select * from test_index_ht order by 1;
select * from test_index_ht order by 1;
a | b | c
---+---+---
3 | |
@ -306,6 +328,6 @@ select * from test_index_ht order by 1;
6 | |
(4 rows)
drop table test_index_ht;
drop schema fvt_other_cmd cascade;
drop table test_index_ht;
drop schema fvt_other_cmd cascade;
NOTICE: drop cascades to table fvt_other_cmd.idex_list_partition_table_001

View File

@ -1,8 +1,6 @@
--
---- test partition for (null)
--
-- 1. test ordinary
-- 1.1 range partitioned table
-- 1.2 interval partitioned table
@ -12,11 +10,8 @@
-- 3. MAXVALUE
-- 3.1 MAXVALUE is first column
-- 3.2 MAXVALUE is second column
CREATE schema FVT_COMPRESS_QWER;
set search_path to FVT_COMPRESS_QWER;
-- 1. test ordinary
---- 1.1 range partitioned table
create table test_partition_for_null_hash (a int, b int, c int, d int)
@ -26,18 +21,14 @@ partition by hash (a)
partition test_partition_for_null_hash_p2,
partition test_partition_for_null_hash_p3
);
insert into test_partition_for_null_hash values (0, 0, 0, 0);
insert into test_partition_for_null_hash values (1, 1, 1, 1);
insert into test_partition_for_null_hash values (5, 5, 5, 5);
-- failed: inserted partition key does not map to any table partition
insert into test_partition_for_null_hash values (null, null, null, null);
ERROR: inserted partition key does not map to any table partition
-- success
insert into test_partition_for_null_hash values (0, null, null, null);
-- failed: The partition number is invalid or out-of-range
select * from test_partition_for_null_hash partition for (null) order by 1, 2, 3, 4;
ERROR: Cannot find partition by the value
@ -50,8 +41,6 @@ select * from test_partition_for_null_hash partition for (0) order by 1, 2, 3, 4
0 | | |
(2 rows)
-- failed: The partition number is invalid or out-of-range
alter table test_partition_for_null_hash rename partition for (null) to test_partition_for_null_hash_part1;
ERROR: The partition number is invalid or out-of-range
@ -65,12 +54,10 @@ select * from test_partition_for_null_hash partition (test_partition_for_null_ha
0 | | |
(2 rows)
alter table test_partition_for_null_hash drop partition for (NULL);
ERROR: Droping hash partition is unsupported.
alter table test_partition_for_null_hash drop partition for (0);
ERROR: Droping hash partition is unsupported.
CREATE TABLE select_hash_partition_table_000_3(
C_CHAR_1 CHAR(1),
C_CHAR_2 CHAR(10),
@ -92,10 +79,8 @@ CREATE TABLE select_hash_partition_table_000_3(
partition select_hash_partition_000_3_1,
partition select_hash_partition_000_3_2
);
create index select_list_partition_table_index_000_3 ON select_hash_partition_table_000_3(C_CHAR_3,C_VARCHAR_3,C_INT,C_TS_WITHOUT) local(partition select_list_partition_000_3_1, partition select_list_partition_000_3_3);
create view select_list_partition_table_view_000_3 as select * from select_hash_partition_table_000_3;
INSERT INTO select_hash_partition_table_000_3 VALUES('A','ABC','ABCDEFG','a','abc','abcdefg',111,111111,11,1.1,1.11,1.111,'2000-01-01','2000-01-01 01:01:01','2000-01-01 01:01:01+01');
INSERT INTO select_hash_partition_table_000_3 VALUES('B','BCD','BCDEFGH','b','bcd','bcdefgh',222,222222,22,2.2,2.22,2.222,'2000-02-02','2000-02-02 02:02:02','2000-02-02 02:02:02+02');
INSERT INTO select_hash_partition_table_000_3 VALUES('C','CDE','CDEFGHI','c','cde','cdefghi',333,333333,33,3.3,3.33,3.333,'2000-03-03','2000-03-03 03:03:03','2000-03-03 03:03:03+03');
@ -109,49 +94,38 @@ INSERT INTO select_hash_partition_table_000_3 VALUES('H','HIJ','HIJKLMN','h','hi
INSERT INTO select_hash_partition_table_000_3 VALUES('I','IJK','IJKLMNO','i','ijk','ijklmno',999,999999,99,9.9,9.99,9.999,'2000-09-09','2000-09-09 09:09:09','2000-09-09 09:09:09+09');
INSERT INTO select_hash_partition_table_000_3 VALUES('I','IJK','IJKLMNO','i','ijk','ijklmno',1100,999999,99,9.9,9.99,9.999,'2000-09-09','2000-09-09 09:09:09','2000-09-09 09:09:09+09');
INSERT INTO select_hash_partition_table_000_3 VALUES('I','IJK','IJKLMNO','i','ijk','ijklmno',1600,999999,99,9.9,9.99,9.999,'2000-09-09','2000-09-09 09:09:09','2000-09-09 09:09:09+09');
select * from select_hash_partition_table_000_3 partition for (NULL) order by C_INT;
ERROR: Cannot find partition by the value
DETAIL: N/A.
alter table select_hash_partition_table_000_3 rename partition for (NULL) to select_hash_partition_table_000_3_p1;
ERROR: The partition number is invalid or out-of-range
alter table select_hash_partition_table_000_3 drop partition for (NULL);
ERROR: Cannot perform this operation because There are views or rules that depend on table select_hash_partition_table_000_3.
DETAIL: N/A
HINT: drop the views or rules first. Use pg_rules to find rules. Use pg_class, pg_rewrite, pg_depend, pg_namespacesql to find views
CREATE TABLE partition_wise_join_table_001_1 (ID INT NOT NULL,NAME VARCHAR(50) NOT NULL,SCORE NUMERIC(4,1),BIRTHDAY TIMESTAMP WITHOUT TIME ZONE,ADDRESS TEXT,SALARY double precision,RANK SMALLINT)
partition by hash(ID)
(
partition partition_wise_join_table_001_1_1,
partition partition_wise_join_table_001_1_2
) ;
INSERT INTO partition_wise_join_table_001_1 VALUES (generate_series(1,9),'PARTITION WIASE JOIN 1-1-' || generate_series(1,10),90 + random() * 10,'1990-8-8',$$No.88# Science 6 Street of Xi'an of China $$,10000,13 );
INSERT INTO partition_wise_join_table_001_1 VALUES (generate_series(41,49),'PARTITION WIASE JOIN 1-3-' || generate_series(40,60),90 + random() * 10,'1990-8-8',$$No.88# Science 6 Street of Xi'an of China $$,15000,15 );
create index idx_partition_wise_join_table_001_1_1 on partition_wise_join_table_001_1(ID) LOCAL;
create index idx_partition_wise_join_table_001_1_2 on partition_wise_join_table_001_1(ID,NAME) LOCAL;
create index idx_partition_wise_join_table_001_1_3 on partition_wise_join_table_001_1(RANK) LOCAL;
create index idx_partition_wise_join_table_001_1_4 on partition_wise_join_table_001_1(RANK,SALARY,NAME) LOCAL;
CREATE TABLE partition_wise_join_table_001_2 (ID INT NOT NULL,NAME VARCHAR(50) NOT NULL,SCORE NUMERIC(4,1),BIRTHDAY TIMESTAMP WITHOUT TIME ZONE,ADDRESS TEXT,SALARY double precision )
partition by hash(ID)
(
partition partition_wise_join_table_001_1_1,
partition partition_wise_join_table_001_1_2
);
INSERT INTO partition_wise_join_table_001_2 VALUES (generate_series(1,9),'PARTITION WIASE JOIN 2-1-' || generate_series(1,10),90 + random() * 10,'1990-8-8',$$No 66# Science 4 Street of Xi'an of China $$,10000);
INSERT INTO partition_wise_join_table_001_2 VALUES (generate_series(71,79),'PARTITION WIASE JOIN 2-3-' || generate_series(70,80),90 + random() * 10,'1990-8-8',$$No 77# Science 4 Street of Xi'an of China $$,15000);
CREATE INDEX IDX_PARTITION_WISE_JOIN_TABLE_001_2_1 ON PARTITION_WISE_JOIN_TABLE_001_2(ID) LOCAL;
CREATE INDEX IDX_PARTITION_WISE_JOIN_TABLE_001_2_2 ON PARTITION_WISE_JOIN_TABLE_001_2(ID,NAME) LOCAL;
CREATE INDEX IDX_PARTITION_WISE_JOIN_TABLE_001_2_3 ON PARTITION_WISE_JOIN_TABLE_001_2(SALARY,NAME) LOCAL;
SELECT A.ID,B.ID,A.RANK,B.SALARY,A.SALARY,A.ADDRESS,B.BIRTHDAY FROM PARTITION_WISE_JOIN_TABLE_001_1 A,PARTITION_WISE_JOIN_TABLE_001_2 B WHERE A.ID = B.ID AND A.ID < 100 OR A.ID >400 order by 1, 2;
id | id | rank | salary | salary | address | birthday
----+----+------+--------+--------+----------------------------------------------+--------------------------
@ -1057,10 +1031,8 @@ SELECT A.ID,B.ID,A.RANK,B.SALARY,A.SALARY,A.ADDRESS,B.BIRTHDAY FROM PARTITION_WI
9 | 9 | 13 | 10000 | 10000 | No.88# Science 6 Street of Xi'an of China | Wed Aug 08 00:00:00 1990
(900 rows)
ANALYZE PARTITION_WISE_JOIN_TABLE_001_1;
ANALYZE PARTITION_WISE_JOIN_TABLE_001_2;
SELECT A.ID,B.ID,A.RANK,B.SALARY,A.SALARY,A.ADDRESS,B.BIRTHDAY FROM PARTITION_WISE_JOIN_TABLE_001_1 A,PARTITION_WISE_JOIN_TABLE_001_2 B WHERE A.ID = B.ID AND A.ID < 100 OR A.ID >400 order by 1, 2;
id | id | rank | salary | salary | address | birthday
----+----+------+--------+--------+----------------------------------------------+--------------------------
@ -1966,7 +1938,6 @@ SELECT A.ID,B.ID,A.RANK,B.SALARY,A.SALARY,A.ADDRESS,B.BIRTHDAY FROM PARTITION_WI
9 | 9 | 13 | 10000 | 10000 | No.88# Science 6 Street of Xi'an of China | Wed Aug 08 00:00:00 1990
(900 rows)
CREATE TABLE HW_PARTITION_SELECT_RT (A INT, B INT)
PARTITION BY hash(A)
(
@ -1986,7 +1957,6 @@ EXPLAIN (COSTS OFF) SELECT B FROM (SELECT B FROM HW_PARTITION_SELECT_RT LIMIT 10
Selected Partitions: 1..3
(7 rows)
CREATE TABLE TESTTABLE_TEST1(A INT) PARTITION BY HASH (A)(PARTITION TESTTABLE_TEST1_P1);
CREATE TABLE TESTTABLE_TEST2(A INT);
SELECT * FROM TESTTABLE_TEST1 UNION ALL SELECT * FROM TESTTABLE_TEST2 order by 1;
@ -1994,7 +1964,6 @@ SELECT * FROM TESTTABLE_TEST1 UNION ALL SELECT * FROM TESTTABLE_TEST2 order by 1
---
(0 rows)
CREATE TABLE select_partition_table_000_3(
C_CHAR_1 CHAR(1),
C_CHAR_2 CHAR(10),
@ -2016,10 +1985,8 @@ CREATE TABLE select_partition_table_000_3(
partition select_partition_000_3_1,
partition select_partition_000_3_2
);
create index select_partition_table_index_000_3 ON select_partition_table_000_3(C_CHAR_3,C_VARCHAR_3,C_INT,C_TS_WITHOUT) local(partition select_partition_000_3_1, partition select_partition_000_3_3);
create view select_partition_table_view_000_3 as select * from select_partition_table_000_3;
INSERT INTO select_partition_table_000_3 VALUES('A','ABC','ABCDEFG','a','abc','abcdefg',111,111111,11,1.1,1.11,1.111,'2000-01-01','2000-01-01 01:01:01','2000-01-01 01:01:01+01');
INSERT INTO select_partition_table_000_3 VALUES('B','BCD','BCDEFGH','b','bcd','bcdefgh',222,222222,22,2.2,2.22,2.222,'2000-02-02','2000-02-02 02:02:02','2000-02-02 02:02:02+02');
INSERT INTO select_partition_table_000_3 VALUES('C','CDE','CDEFGHI','c','cde','cdefghi',333,333333,33,3.3,3.33,3.333,'2000-03-03','2000-03-03 03:03:03','2000-03-03 03:03:03+03');
@ -2033,7 +2000,6 @@ INSERT INTO select_partition_table_000_3 VALUES('H','HIJ','HIJKLMN','h','hij','h
INSERT INTO select_partition_table_000_3 VALUES('I','IJK','IJKLMNO','i','ijk','ijklmno',999,999999,99,9.9,9.99,9.999,'2000-09-09','2000-09-09 09:09:09','2000-09-09 09:09:09+09');
INSERT INTO select_partition_table_000_3 VALUES('I','IJK','IJKLMNO','i','ijk','ijklmno',1100,999999,99,9.9,9.99,9.999,'2000-09-09','2000-09-09 09:09:09','2000-09-09 09:09:09+09');
INSERT INTO select_partition_table_000_3 VALUES('I','IJK','IJKLMNO','i','ijk','ijklmno',1600,999999,99,9.9,9.99,9.999,'2000-09-09','2000-09-09 09:09:09','2000-09-09 09:09:09+09');
explain (costs off, verbose on) select lower(C_CHAR_3), initcap(C_VARCHAR_3), sqrt(C_INT), C_NUMERIC- 1 + 2*6/3, rank() over w from select_partition_table_000_3 where C_INT > 600 or C_BIGINT < 444444 window w as (partition by C_TS_WITHOUT) order by 1,2,3,4,5;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@ -2054,7 +2020,6 @@ explain (costs off, verbose on) select lower(C_CHAR_3), initcap(C_VARCHAR_3), sq
Selected Partitions: 1..2
(15 rows)
select lower(C_CHAR_3), initcap(C_VARCHAR_3), sqrt(C_INT), C_NUMERIC- 1 + 2*6/3, rank() over w from select_partition_table_000_3 where C_INT > 600 or C_BIGINT < 444444 window w as (partition by C_TS_WITHOUT) order by 1,2,3,4,5;
lower | initcap | sqrt | ?column? | rank
---------+---------+------------------+----------+------
@ -2071,17 +2036,13 @@ select lower(C_CHAR_3), initcap(C_VARCHAR_3), sqrt(C_INT), C_NUMERIC- 1 + 2*6/3,
ijklmno | Ijklmno | 40 | 12.99 | 1
(11 rows)
create table hw_partition_select_rt5 (a int, b int, c int)
partition by hash(c)
(
partition hw_partition_select_rt5_p1
);
alter table hw_partition_select_rt5 drop column b;
update hw_partition_select_rt5 set c=0 where c=-1;
drop schema FVT_COMPRESS_QWER cascade;
NOTICE: drop cascades to 11 other objects
DETAIL: drop cascades to table test_partition_for_null_hash
@ -2095,7 +2056,6 @@ drop cascades to table testtable_test2
drop cascades to table select_partition_table_000_3
drop cascades to view select_partition_table_view_000_3
drop cascades to table hw_partition_select_rt5
--begin: these test are related to explain output change about partition table.
-- major change is as below
--1.
@ -2108,8 +2068,6 @@ drop cascades to table hw_partition_select_rt5
--Selected Partitions: 1,3,5,7,9
CREATE schema FVT_COMPRESS;
set search_path to FVT_COMPRESS;
create table test_explain_format_on_part_table (id int)
partition by hash(id)
(
@ -2207,10 +2165,8 @@ explain (verbose on, costs off, FORMAT JSON)
]
(1 row)
drop table test_explain_format_on_part_table;
--end: these test are related to explain output change about partition table.
create table hw_partition_select_parttable (
c1 int,
c2 int,
@ -2232,7 +2188,6 @@ select * from hw_partition_select_parttable order by 1, 2, 3;
300 | 200 |
(3 rows)
select c1 from hw_partition_select_parttable order by 1;
c1
-----
@ -2241,7 +2196,6 @@ select c1 from hw_partition_select_parttable order by 1;
300
(3 rows)
select c1,c2 from hw_partition_select_parttable order by 1, 2;
c1 | c2
-----+-----
@ -2250,7 +2204,6 @@ select c1,c2 from hw_partition_select_parttable order by 1, 2;
300 | 200
(3 rows)
select c2 from hw_partition_select_parttable order by 1;
c2
-----
@ -2259,7 +2212,6 @@ select c2 from hw_partition_select_parttable order by 1;
200
(3 rows)
select c1,c2,c3 from hw_partition_select_parttable order by 1, 2, 3;
c1 | c2 | c3
-----+-----+-----
@ -2268,21 +2220,18 @@ select c1,c2,c3 from hw_partition_select_parttable order by 1, 2, 3;
300 | 200 |
(3 rows)
select c1 from hw_partition_select_parttable where c1>50 and c1<300 order by 1;
c1
-----
100
(1 row)
select * from hw_partition_select_parttable where c2>100 order by 1, 2, 3;
c1 | c2 | c3
-----+-----+----
300 | 200 |
(1 row)
create table t_select_datatype_int32(c1 int,c2 int,c3 int,c4 text)
partition by hash(c1)
(partition t_select_datatype_int32_p1,
@ -2291,7 +2240,6 @@ partition by hash(c1)
partition t_select_datatype_int32_p4);
insert into t_select_datatype_int32 values(-100,20,20,'a'), (100,300,300,'bb'), (150,75,500,NULL), (200,500,50,'ccc'), (250,50,50,NULL), (300,700,125,''), (450,35,150,'dddd');
--partition select for int32
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1=50 order by 1, 2, 3, 4;
@ -2299,7 +2247,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1=50 order
----+----+----+----
(0 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1=100 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2307,7 +2254,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1=100 order
100 | 300 | 300 | bb
(1 row)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1=250 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2315,21 +2261,18 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1=250 order
250 | 50 | 50 |
(1 row)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1=500 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
----+----+----+----
(0 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1=550 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
----+----+----+----
(0 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2337,7 +2280,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 order
-100 | 20 | 20 | a
(1 row)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<=50 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2345,7 +2287,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<=50 order
-100 | 20 | 20 | a
(1 row)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<100 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2353,7 +2294,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<100 order
-100 | 20 | 20 | a
(1 row)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<=100 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2362,7 +2302,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<=100 orde
100 | 300 | 300 | bb
(2 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<150 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2371,7 +2310,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<150 order
100 | 300 | 300 | bb
(2 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<200 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2381,7 +2319,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<200 order
150 | 75 | 500 |
(3 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<=200 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2392,7 +2329,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<=200 orde
200 | 500 | 50 | ccc
(4 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<500 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2406,7 +2342,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<500 order
450 | 35 | 150 | dddd
(7 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<=500 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2420,7 +2355,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<=500 orde
450 | 35 | 150 | dddd
(7 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<700 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2434,7 +2368,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<700 order
450 | 35 | 150 | dddd
(7 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<=700 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2448,7 +2381,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<=700 orde
450 | 35 | 150 | dddd
(7 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>50 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2461,7 +2393,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>50 order
450 | 35 | 150 | dddd
(6 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=50 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2474,7 +2405,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=50 order
450 | 35 | 150 | dddd
(6 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>100 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2486,7 +2416,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>100 order
450 | 35 | 150 | dddd
(5 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=100 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2499,7 +2428,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=100 orde
450 | 35 | 150 | dddd
(6 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>150 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2510,7 +2438,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>150 order
450 | 35 | 150 | dddd
(4 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=150 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2522,7 +2449,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=150 orde
450 | 35 | 150 | dddd
(5 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>200 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2532,7 +2458,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>200 order
450 | 35 | 150 | dddd
(3 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=200 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2543,21 +2468,18 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=200 orde
450 | 35 | 150 | dddd
(4 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>500 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
----+----+----+----
(0 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=500 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
----+----+----+----
(0 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 AND t_select_datatype_int32.c1<250 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2565,21 +2487,18 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 AND t_
-100 | 20 | 20 | a
(1 row)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 AND t_select_datatype_int32.c1>0 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
----+----+----+----
(0 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 AND t_select_datatype_int32.c1>100 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
----+----+----+----
(0 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>50 AND t_select_datatype_int32.c1>=150 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2591,7 +2510,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>50 AND t_
450 | 35 | 150 | dddd
(5 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>100 AND t_select_datatype_int32.c1>=100 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2603,7 +2521,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>100 AND t
450 | 35 | 150 | dddd
(5 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=100 AND t_select_datatype_int32.c1=100 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2611,7 +2528,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=100 AND
100 | 300 | 300 | bb
(1 row)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=100 AND t_select_datatype_int32.c1<300 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2622,7 +2538,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=100 AND
250 | 50 | 50 |
(4 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=100 AND t_select_datatype_int32.c1<550 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2635,7 +2550,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=100 AND
450 | 35 | 150 | dddd
(6 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>100 AND t_select_datatype_int32.c1<=500 AND t_select_datatype_int32.c1>=100 AND t_select_datatype_int32.c1<500 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2647,14 +2561,12 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>100 AND t
450 | 35 | 150 | dddd
(5 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>250 AND t_select_datatype_int32.c1<50 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
----+----+----+----
(0 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>50 AND t_select_datatype_int32.c1>100 AND t_select_datatype_int32.c1>=100 AND t_select_datatype_int32.c1<250 AND t_select_datatype_int32.c1<=250 AND t_select_datatype_int32.c1=200 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2662,7 +2574,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>50 AND t_
200 | 500 | 50 | ccc
(1 row)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 OR t_select_datatype_int32.c1<250 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2673,7 +2584,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 OR t_s
200 | 500 | 50 | ccc
(4 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 OR t_select_datatype_int32.c1>0 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2687,7 +2597,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 OR t_s
450 | 35 | 150 | dddd
(7 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 OR t_select_datatype_int32.c1>100 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2700,7 +2609,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 OR t_s
450 | 35 | 150 | dddd
(6 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>50 OR t_select_datatype_int32.c1>=150 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2713,7 +2621,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>50 OR t_s
450 | 35 | 150 | dddd
(6 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>100 OR t_select_datatype_int32.c1>=100 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2726,7 +2633,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>100 OR t_
450 | 35 | 150 | dddd
(6 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=100 OR t_select_datatype_int32.c1=100 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2739,7 +2645,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=100 OR t
450 | 35 | 150 | dddd
(6 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=100 OR t_select_datatype_int32.c1<200 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2753,7 +2658,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=100 OR t
450 | 35 | 150 | dddd
(7 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>500 OR t_select_datatype_int32.c1<250 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2764,7 +2668,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>500 OR t_
200 | 500 | 50 | ccc
(4 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>100 OR t_select_datatype_int32.c1<=300 OR t_select_datatype_int32.c1>=100 OR t_select_datatype_int32.c1<300 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2778,7 +2681,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>100 OR t_
450 | 35 | 150 | dddd
(7 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>250 OR t_select_datatype_int32.c1<50 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2788,7 +2690,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>250 OR t_
450 | 35 | 150 | dddd
(3 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<170 AND ( t_select_datatype_int32.c1>600 OR t_select_datatype_int32.c1<150) order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2797,7 +2698,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<170 AND
100 | 300 | 300 | bb
(2 rows)
--success
select * from t_select_datatype_int32 where (t_select_datatype_int32.c1<170 OR t_select_datatype_int32.c1<250) AND ( t_select_datatype_int32.c1>600 OR t_select_datatype_int32.c1<150) order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2806,7 +2706,6 @@ select * from t_select_datatype_int32 where (t_select_datatype_int32.c1<170 OR t
100 | 300 | 300 | bb
(2 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 OR t_select_datatype_int32.c1>250 AND t_select_datatype_int32.c1<400 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2815,7 +2714,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 OR t_s
300 | 700 | 125 |
(2 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=-100 AND t_select_datatype_int32.c1<50 OR t_select_datatype_int32.c1>300 AND t_select_datatype_int32.c1<700 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2824,7 +2722,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=-100 AND
450 | 35 | 150 | dddd
(2 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=-100 AND t_select_datatype_int32.c1<=100 OR t_select_datatype_int32.c1>300 AND t_select_datatype_int32.c1<700 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2834,7 +2731,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=-100 AND
450 | 35 | 150 | dddd
(3 rows)
--IS NULL
--success
select * from t_select_datatype_int32 where
@ -2850,7 +2746,6 @@ select * from t_select_datatype_int32 where
300 | 700 | 125 |
(3 rows)
--success
select * from t_select_datatype_int32 where
(t_select_datatype_int32.c1>500 OR t_select_datatype_int32.c1<250) AND
@ -2862,7 +2757,6 @@ select * from t_select_datatype_int32 where
----+----+----+----
(0 rows)
--success
select * from t_select_datatype_int32 where
t_select_datatype_int32.c4 IS NULL AND
@ -2874,7 +2768,6 @@ select * from t_select_datatype_int32 where
----+----+----+----
(0 rows)
--success
select * from t_select_datatype_int32 where
t_select_datatype_int32.c4 IS NULL OR
@ -2889,7 +2782,6 @@ select * from t_select_datatype_int32 where
300 | 700 | 125 |
(3 rows)
--success
select * from t_select_datatype_int32 where
(t_select_datatype_int32.c1>500 OR t_select_datatype_int32.c1<250) AND
@ -2900,7 +2792,6 @@ select * from t_select_datatype_int32 where
----+----+----+----
(0 rows)
--success
select * from t_select_datatype_int32 where
(t_select_datatype_int32.c1>500 OR t_select_datatype_int32.c1<250) AND
@ -2911,16 +2802,12 @@ select * from t_select_datatype_int32 where
----+----+----+----
(0 rows)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- check select contarins partition
--
---- check select from range partition
--
create table hw_partition_select_ordinary_table (a int, b int);
create table test_select_hash_partition (a int, b int)
partition by hash(a)
(
@ -2928,16 +2815,13 @@ partition by hash(a)
partition test_select_hash_partition_p2,
partition test_select_hash_partition_p3
);
insert into test_select_hash_partition values(2);
--success
select * from test_select_hash_partition partition (test_select_hash_partition_p1) order by 1, 2;
a | b
---+---
(0 rows)
--success
select * from test_select_hash_partition partition (test_select_hash_partition_p2) order by 1, 2;
a | b
@ -2945,18 +2829,15 @@ select * from test_select_hash_partition partition (test_select_hash_partition_p
2 |
(1 row)
--success
select * from test_select_hash_partition partition (test_select_hash_partition_p3) order by 1, 2;
a | b
---+---
(0 rows)
--success
select * from test_select_hash_partition partition (test_select_hash_partition_p4) order by 1, 2;
ERROR: partition "test_select_hash_partition_p4" of relation "test_select_hash_partition" does not exist
--success
select a from test_select_hash_partition partition (test_select_hash_partition_p2) order by 1;
a
@ -2964,7 +2845,6 @@ select a from test_select_hash_partition partition (test_select_hash_partition_p
2
(1 row)
--success
select a from test_select_hash_partition partition for (0) order by 1;
a
@ -2972,14 +2852,12 @@ select a from test_select_hash_partition partition for (0) order by 1;
2
(1 row)
--success
select a from test_select_hash_partition partition for (1) order by 1;
a
---
(0 rows)
--success
select a from test_select_hash_partition partition for (2) order by 1;
a
@ -2987,31 +2865,26 @@ select a from test_select_hash_partition partition for (2) order by 1;
2
(1 row)
--success
select a from test_select_hash_partition partition for (5) order by 1;
a
---
(0 rows)
--success
select a from test_select_hash_partition partition for (8) order by 1;
a
---
(0 rows)
-- fail: table is not partitioned table
select a from hw_partition_select_ordinary_table partition (test_select_hash_partition_p2);
ERROR: relation "hw_partition_select_ordinary_table" is not partitioned table
DETAIL: N/A.
-- fail: table is not partitioned table
select a from hw_partition_select_ordinary_table partition for (2);
ERROR: relation "hw_partition_select_ordinary_table" is not partitioned table
DETAIL: N/A.
--
--
CREATE TABLE hw_partition_select_test(C_INT INTEGER)
@ -3024,14 +2897,12 @@ CREATE TABLE hw_partition_select_test(C_INT INTEGER)
insert into hw_partition_select_test values(111);
insert into hw_partition_select_test values(555);
insert into hw_partition_select_test values(888);
select a.* from hw_partition_select_test partition(hw_partition_select_test_part_1) a;
c_int
-------
888
(1 row)
create table hash_partitioned_table (a int)
partition by hash(a)
(
@ -3039,12 +2910,10 @@ partition by hash(a)
partition hash_partitioned_table_p2,
partition hash_partitioned_table_p3
);
insert into hash_partitioned_table values (1);
insert into hash_partitioned_table values (2);
insert into hash_partitioned_table values (5);
insert into hash_partitioned_table values (6);
with tmp1 as (select a from hash_partitioned_table partition for (2)) select a from tmp1 order by 1;
a
---
@ -3052,7 +2921,6 @@ with tmp1 as (select a from hash_partitioned_table partition for (2)) select a f
6
(2 rows)
drop schema FVT_COMPRESS cascade;
NOTICE: drop cascades to 6 other objects
DETAIL: drop cascades to table hw_partition_select_parttable
@ -3061,8 +2929,3 @@ drop cascades to table hw_partition_select_ordinary_table
drop cascades to table test_select_hash_partition
drop cascades to table hw_partition_select_test
drop cascades to table hash_partitioned_table

View File

@ -1,273 +1,279 @@
CREATE schema FVT_COMPRESS_QWER;
set search_path to FVT_COMPRESS_QWER;
create table bmsql_order_line (
ol_w_id integer not null,
ol_d_id integer not null,
ol_o_id integer not null,
ol_number integer not null,
ol_i_id integer not null,
ol_delivery_d timestamp,
ol_amount decimal(6,2),
ol_supply_w_id integer,
ol_quantity integer,
ol_dist_info char(24)
)
partition by list(ol_d_id)
(
partition p0 values (1,4,7),
partition p1 values (2,5,8),
partition p2 values (3,6,9)
);
alter table bmsql_order_line add constraint bmsql_order_line_pkey primary key (ol_w_id, ol_d_id, ol_o_id, ol_number);
CREATE schema FVT_COMPRESS_QWER;
set search_path to FVT_COMPRESS_QWER;
create table bmsql_order_line (
ol_w_id integer not null,
ol_d_id integer not null,
ol_o_id integer not null,
ol_number integer not null,
ol_i_id integer not null,
ol_delivery_d timestamp,
ol_amount decimal(6,2),
ol_supply_w_id integer,
ol_quantity integer,
ol_dist_info char(24)
)
partition by list(ol_d_id)
(
partition p0 values (1,4,7),
partition p1 values (2,5,8),
partition p2 values (3,6,9)
);
alter table bmsql_order_line add constraint bmsql_order_line_pkey primary key (ol_w_id, ol_d_id, ol_o_id, ol_number);
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "bmsql_order_line_pkey" for table "bmsql_order_line"
insert into bmsql_order_line(ol_w_id, ol_d_id, ol_o_id, ol_number, ol_i_id, ol_dist_info) values(1, 1, 1, 1, 1, '123');
update bmsql_order_line set ol_dist_info='ss' where ol_w_id =1;
delete from bmsql_order_line;
create table test_partition_for_null_list_timestamp
(
a timestamp without time zone,
b timestamp with time zone,
c int,
d int)
partition by list (a)
(
partition test_partition_for_null_list_timestamp_p1 values ('2000-01-01 01:01:01', '2000-01-01 01:01:02'),
partition test_partition_for_null_list_timestamp_p2 values ('2000-02-02 02:02:02', '2000-02-02 02:02:04'),
partition test_partition_for_null_list_timestamp_p3 values ('2000-03-03 03:03:03', '2000-03-03 03:03:06')
);
create index idx_test_partition_for_null_list_timestamp_1 on test_partition_for_null_list_timestamp(a) LOCAL;
create index idx_test_partition_for_null_list_timestamp_2 on test_partition_for_null_list_timestamp(a,b) LOCAL;
create index idx_test_partition_for_null_list_timestamp_3 on test_partition_for_null_list_timestamp(c) LOCAL;
create index idx_test_partition_for_null_list_timestamp_4 on test_partition_for_null_list_timestamp(b,c,d) LOCAL;
create table test_partition_for_null_list_text (a text, b varchar(2), c char(1), d varchar(2))
partition by list (a)
(
partition test_partition_for_null_list_text_p1 values ('A'),
partition test_partition_for_null_list_text_p2 values ('B','C','D','E'),
partition test_partition_for_null_list_text_p3 values ('F','G')
);
insert into bmsql_order_line(ol_w_id, ol_d_id, ol_o_id, ol_number, ol_i_id, ol_dist_info) values(1, 1, 1, 1, 1, '123');
update bmsql_order_line set ol_dist_info='ss' where ol_w_id =1;
delete from bmsql_order_line;
create table test_partition_for_null_list_timestamp
(
a timestamp without time zone,
b timestamp with time zone,
c int,
d int)
partition by list (a)
(
partition test_partition_for_null_list_timestamp_p1 values ('2000-01-01 01:01:01', '2000-01-01 01:01:02'),
partition test_partition_for_null_list_timestamp_p2 values ('2000-02-02 02:02:02', '2000-02-02 02:02:04'),
partition test_partition_for_null_list_timestamp_p3 values ('2000-03-03 03:03:03', '2000-03-03 03:03:06')
);
create index idx_test_partition_for_null_list_timestamp_1 on test_partition_for_null_list_timestamp(a) LOCAL;
create index idx_test_partition_for_null_list_timestamp_2 on test_partition_for_null_list_timestamp(a,b) LOCAL;
create index idx_test_partition_for_null_list_timestamp_3 on test_partition_for_null_list_timestamp(c) LOCAL;
create index idx_test_partition_for_null_list_timestamp_4 on test_partition_for_null_list_timestamp(b,c,d) LOCAL;
create table test_partition_for_null_list_text (a text, b varchar(2), c char(1), d varchar(2))
partition by list (a)
(
partition test_partition_for_null_list_text_p1 values ('A'),
partition test_partition_for_null_list_text_p2 values ('B','C','D','E'),
partition test_partition_for_null_list_text_p3 values ('F','G')
);
ERROR: column a cannot serve as a list partitioning column because of its datatype
create index idx_test_partition_for_null_list_text_1 on test_partition_for_null_list_text(a) LOCAL;
create index idx_test_partition_for_null_list_text_1 on test_partition_for_null_list_text(a) LOCAL;
ERROR: relation "test_partition_for_null_list_text" does not exist
create index idx_test_partition_for_null_list_text_2 on test_partition_for_null_list_text(a,b) LOCAL;
create index idx_test_partition_for_null_list_text_2 on test_partition_for_null_list_text(a,b) LOCAL;
ERROR: relation "test_partition_for_null_list_text" does not exist
create index idx_test_partition_for_null_list_text_3 on test_partition_for_null_list_text(c) LOCAL;
create index idx_test_partition_for_null_list_text_3 on test_partition_for_null_list_text(c) LOCAL;
ERROR: relation "test_partition_for_null_list_text" does not exist
create index idx_test_partition_for_null_list_text_4 on test_partition_for_null_list_text(b,c,d) LOCAL;
create index idx_test_partition_for_null_list_text_4 on test_partition_for_null_list_text(b,c,d) LOCAL;
ERROR: relation "test_partition_for_null_list_text" does not exist
create index idx_test_partition_for_null_list_text_5 on test_partition_for_null_list_text(b,c,d);
create index idx_test_partition_for_null_list_text_5 on test_partition_for_null_list_text(b,c,d);
ERROR: relation "test_partition_for_null_list_text" does not exist
CREATE TABLE select_partition_table_000_1(
C_CHAR_1 CHAR(1),
C_CHAR_2 CHAR(10),
C_CHAR_3 CHAR(102400),
C_VARCHAR_1 VARCHAR(1),
C_VARCHAR_2 VARCHAR(10),
C_VARCHAR_3 VARCHAR(1024),
C_INT INTEGER,
C_BIGINT BIGINT,
C_SMALLINT SMALLINT,
C_FLOAT FLOAT,
C_NUMERIC numeric(10,5),
C_DP double precision,
C_DATE DATE,
C_TS_WITHOUT TIMESTAMP WITHOUT TIME ZONE,
C_TS_WITH TIMESTAMP WITH TIME ZONE )
partition by list (C_BIGINT)
(
partition select_partition_000_1_1 values (1,2,3,4),
partition select_partition_000_1_2 values (5,6,7,8,9)
);
create index idx_select_partition_table_000_1_1 on select_partition_table_000_1(C_CHAR_1) LOCAL;
create index idx_select_partition_table_000_1_2 on select_partition_table_000_1(C_CHAR_1,C_VARCHAR_1) LOCAL;
create index idx_select_partition_table_000_1_3 on select_partition_table_000_1(C_BIGINT) LOCAL;
create index idx_select_partition_table_000_1_4 on select_partition_table_000_1(C_BIGINT,C_TS_WITH,C_DP) LOCAL;
create index idx_select_partition_table_000_1_5 on select_partition_table_000_1(C_BIGINT,C_NUMERIC,C_TS_WITHOUT);
CREATE TABLE select_partition_table_000_2(
C_CHAR_1 CHAR(1),
C_CHAR_2 CHAR(10),
C_CHAR_3 CHAR(102400),
C_VARCHAR_1 VARCHAR(1),
C_VARCHAR_2 VARCHAR(10),
C_VARCHAR_3 VARCHAR(1024),
C_INT INTEGER,
C_BIGINT BIGINT,
C_SMALLINT SMALLINT,
C_FLOAT FLOAT,
C_NUMERIC numeric(10,5),
C_DP double precision,
C_DATE DATE,
C_TS_WITHOUT TIMESTAMP WITHOUT TIME ZONE,
C_TS_WITH TIMESTAMP WITH TIME ZONE )
partition by list (C_SMALLINT)
(
partition select_partition_000_2_1 values (1,2,3,4),
partition select_partition_000_2_2 values (5,6,7,8,9)
);
create index idx_select_partition_table_000_2_1 on select_partition_table_000_2(C_CHAR_2) LOCAL;
create index idx_select_partition_table_000_2_2 on select_partition_table_000_2(C_CHAR_2,C_VARCHAR_2) LOCAL;
create index idx_select_partition_table_000_2_3 on select_partition_table_000_2(C_SMALLINT) LOCAL;
create index idx_select_partition_table_000_2_4 on select_partition_table_000_2(C_SMALLINT,C_TS_WITH,C_DP) LOCAL;
create index idx_select_partition_table_000_2_5 on select_partition_table_000_2(C_SMALLINT,C_NUMERIC,C_TS_WITHOUT);
CREATE TABLE select_partition_table_000_3(
C_CHAR_1 CHAR(1),
C_CHAR_2 CHAR(10),
C_CHAR_3 CHAR(102400),
C_VARCHAR_1 VARCHAR(1),
C_VARCHAR_2 VARCHAR(10),
C_VARCHAR_3 VARCHAR(1024),
C_INT INTEGER,
C_BIGINT BIGINT,
C_SMALLINT SMALLINT,
C_FLOAT FLOAT,
C_NUMERIC numeric(10,5),
C_DP double precision,
C_DATE DATE,
C_TS_WITHOUT TIMESTAMP WITHOUT TIME ZONE,
C_TS_WITH TIMESTAMP WITH TIME ZONE )
partition by list (C_NUMERIC)
(
partition select_partition_000_3_1 values (1,2,3,4),
partition select_partition_000_3_2 values (5,6,7,8,9)
);
CREATE TABLE select_partition_table_000_4(
C_CHAR_1 CHAR(1),
C_CHAR_2 CHAR(10),
C_CHAR_3 CHAR(102400),
C_VARCHAR_1 VARCHAR(1),
C_VARCHAR_2 VARCHAR(10),
C_VARCHAR_3 VARCHAR(1024),
C_INT INTEGER,
C_BIGINT BIGINT,
C_SMALLINT SMALLINT,
C_FLOAT FLOAT,
C_NUMERIC numeric(10,5),
C_DP double precision,
C_DATE DATE,
C_TS_WITHOUT TIMESTAMP WITHOUT TIME ZONE,
C_TS_WITH TIMESTAMP WITH TIME ZONE )
partition by list (C_DP)
(
partition select_partition_000_4_1 values (1,2,3,4),
partition select_partition_000_4_2 values (5,6,7,8,9)
);
CREATE TABLE select_partition_table_000_1(
C_CHAR_1 CHAR(1),
C_CHAR_2 CHAR(10),
C_CHAR_3 CHAR(102400),
C_VARCHAR_1 VARCHAR(1),
C_VARCHAR_2 VARCHAR(10),
C_VARCHAR_3 VARCHAR(1024),
C_INT INTEGER,
C_BIGINT BIGINT,
C_SMALLINT SMALLINT,
C_FLOAT FLOAT,
C_NUMERIC numeric(10,5),
C_DP double precision,
C_DATE DATE,
C_TS_WITHOUT TIMESTAMP WITHOUT TIME ZONE,
C_TS_WITH TIMESTAMP WITH TIME ZONE )
partition by list (C_BIGINT)
(
partition select_partition_000_1_1 values (1,2,3,4),
partition select_partition_000_1_2 values (5,6,7,8,9)
);
create index idx_select_partition_table_000_1_1 on select_partition_table_000_1(C_CHAR_1) LOCAL;
create index idx_select_partition_table_000_1_2 on select_partition_table_000_1(C_CHAR_1,C_VARCHAR_1) LOCAL;
create index idx_select_partition_table_000_1_3 on select_partition_table_000_1(C_BIGINT) LOCAL;
create index idx_select_partition_table_000_1_4 on select_partition_table_000_1(C_BIGINT,C_TS_WITH,C_DP) LOCAL;
create index idx_select_partition_table_000_1_5 on select_partition_table_000_1(C_BIGINT,C_NUMERIC,C_TS_WITHOUT);
CREATE TABLE select_partition_table_000_2(
C_CHAR_1 CHAR(1),
C_CHAR_2 CHAR(10),
C_CHAR_3 CHAR(102400),
C_VARCHAR_1 VARCHAR(1),
C_VARCHAR_2 VARCHAR(10),
C_VARCHAR_3 VARCHAR(1024),
C_INT INTEGER,
C_BIGINT BIGINT,
C_SMALLINT SMALLINT,
C_FLOAT FLOAT,
C_NUMERIC numeric(10,5),
C_DP double precision,
C_DATE DATE,
C_TS_WITHOUT TIMESTAMP WITHOUT TIME ZONE,
C_TS_WITH TIMESTAMP WITH TIME ZONE )
partition by list (C_SMALLINT)
(
partition select_partition_000_2_1 values (1,2,3,4),
partition select_partition_000_2_2 values (5,6,7,8,9)
);
create index idx_select_partition_table_000_2_1 on select_partition_table_000_2(C_CHAR_2) LOCAL;
create index idx_select_partition_table_000_2_2 on select_partition_table_000_2(C_CHAR_2,C_VARCHAR_2) LOCAL;
create index idx_select_partition_table_000_2_3 on select_partition_table_000_2(C_SMALLINT) LOCAL;
create index idx_select_partition_table_000_2_4 on select_partition_table_000_2(C_SMALLINT,C_TS_WITH,C_DP) LOCAL;
create index idx_select_partition_table_000_2_5 on select_partition_table_000_2(C_SMALLINT,C_NUMERIC,C_TS_WITHOUT);
CREATE TABLE select_partition_table_000_3(
C_CHAR_1 CHAR(1),
C_CHAR_2 CHAR(10),
C_CHAR_3 CHAR(102400),
C_VARCHAR_1 VARCHAR(1),
C_VARCHAR_2 VARCHAR(10),
C_VARCHAR_3 VARCHAR(1024),
C_INT INTEGER,
C_BIGINT BIGINT,
C_SMALLINT SMALLINT,
C_FLOAT FLOAT,
C_NUMERIC numeric(10,5),
C_DP double precision,
C_DATE DATE,
C_TS_WITHOUT TIMESTAMP WITHOUT TIME ZONE,
C_TS_WITH TIMESTAMP WITH TIME ZONE )
partition by list (C_NUMERIC)
(
partition select_partition_000_3_1 values (1,2,3,4),
partition select_partition_000_3_2 values (5,6,7,8,9)
);
CREATE TABLE select_partition_table_000_4(
C_CHAR_1 CHAR(1),
C_CHAR_2 CHAR(10),
C_CHAR_3 CHAR(102400),
C_VARCHAR_1 VARCHAR(1),
C_VARCHAR_2 VARCHAR(10),
C_VARCHAR_3 VARCHAR(1024),
C_INT INTEGER,
C_BIGINT BIGINT,
C_SMALLINT SMALLINT,
C_FLOAT FLOAT,
C_NUMERIC numeric(10,5),
C_DP double precision,
C_DATE DATE,
C_TS_WITHOUT TIMESTAMP WITHOUT TIME ZONE,
C_TS_WITH TIMESTAMP WITH TIME ZONE )
partition by list (C_DP)
(
partition select_partition_000_4_1 values (1,2,3,4),
partition select_partition_000_4_2 values (5,6,7,8,9)
);
ERROR: column c_dp cannot serve as a list partitioning column because of its datatype
create table test_list_default (a int, b int)
partition by list(a)
(
partition p1 values (2000),
partition p2 values (3000),
partition p3 values (4000),
partition p4 values (default)
);
insert into test_list_default values(5000);
select * from test_list_default;
create table test_list_default (a int, b int)
partition by list(a)
(
partition p1 values (2000),
partition p2 values (3000),
partition p3 values (4000),
partition p4 values (default)
);
insert into test_list_default values(5000);
select * from test_list_default;
a | b
------+---
5000 |
(1 row)
select * from test_list_default partition (p4);
select * from test_list_default partition (p4);
a | b
------+---
5000 |
(1 row)
select * from test_list_default partition for (5000);
select * from test_list_default partition for (5000);
a | b
------+---
5000 |
(1 row)
drop table test_list_default;
create table test_list (a int, b int)
partition by list(a)
(
partition p1 values ( 1 ),
partition p2 values ( 2 ),
partition p3 values ( 3 ),
partition p4 values ( 4 ),
partition p5 values ( 5 ),
partition p6 values ( 6 ),
partition p7 values ( 7 ),
partition p8 values ( 8 ),
partition p9 values ( 9 ),
partition p10 values ( 10 ),
partition p11 values ( 11 ),
partition p12 values ( 12 ),
partition p13 values ( 13 ),
partition p14 values ( 14 ),
partition p15 values ( 15 ),
partition p16 values ( 16 ),
partition p17 values ( 17 ),
partition p18 values ( 18 ),
partition p19 values ( 19 ),
partition p20 values ( 20 ),
partition p21 values ( 21 ),
partition p22 values ( 22 ),
partition p23 values ( 23 ),
partition p24 values ( 24 ),
partition p25 values ( 25 ),
partition p26 values ( 26 ),
partition p27 values ( 27 ),
partition p28 values ( 28 ),
partition p29 values ( 29 ),
partition p30 values ( 30 ),
partition p31 values ( 31 ),
partition p32 values ( 32 ),
partition p33 values ( 33 ),
partition p34 values ( 34 ),
partition p35 values ( 35 ),
partition p36 values ( 36 ),
partition p37 values ( 37 ),
partition p38 values ( 38 ),
partition p39 values ( 39 ),
partition p40 values ( 40 ),
partition p41 values ( 41 ),
partition p42 values ( 42 ),
partition p43 values ( 43 ),
partition p44 values ( 44 ),
partition p45 values ( 45 ),
partition p46 values ( 46 ),
partition p47 values ( 47 ),
partition p48 values ( 48 ),
partition p49 values ( 49 ),
partition p50 values ( 50 ),
partition p51 values ( 51 ),
partition p52 values ( 52 ),
partition p53 values ( 53 ),
partition p54 values ( 54 ),
partition p55 values ( 55 ),
partition p56 values ( 56 ),
partition p57 values ( 57 ),
partition p58 values ( 58 ),
partition p59 values ( 59 ),
partition p60 values ( 60 ),
partition p61 values ( 61 ),
partition p62 values ( 62 ),
partition p63 values ( 63 ),
partition p64 values ( 64 ),
partition p65 values ( 65 ),
partition p66 values ( 66 ),
partition p67 values ( 67 ),
partition p68 values ( 68 ),
partition p69 values ( 69 ),
partition p70 values ( 70 ),
partition p71 values ( 71 ),
partition p72 values ( 72 ),
partition p73 values ( 73 ),
partition p74 values ( 74 ),
partition p75 values ( 75 ),
partition p76 values ( 76 ),
partition p77 values ( 77 ),
partition p78 values ( 78 ),
partition p79 values ( 79 ),
partition p80 values ( 80 ),
partition p81 values ( 81 ),
partition p82 values ( 82 )
);
drop table test_list;
drop schema FVT_COMPRESS_QWER cascade;
drop table test_list_default;
create table test_list (a int, b int)
partition by list(a)
(
partition p1 values ( 1 ),
partition p2 values ( 2 ),
partition p3 values ( 3 ),
partition p4 values ( 4 ),
partition p5 values ( 5 ),
partition p6 values ( 6 ),
partition p7 values ( 7 ),
partition p8 values ( 8 ),
partition p9 values ( 9 ),
partition p10 values ( 10 ),
partition p11 values ( 11 ),
partition p12 values ( 12 ),
partition p13 values ( 13 ),
partition p14 values ( 14 ),
partition p15 values ( 15 ),
partition p16 values ( 16 ),
partition p17 values ( 17 ),
partition p18 values ( 18 ),
partition p19 values ( 19 ),
partition p20 values ( 20 ),
partition p21 values ( 21 ),
partition p22 values ( 22 ),
partition p23 values ( 23 ),
partition p24 values ( 24 ),
partition p25 values ( 25 ),
partition p26 values ( 26 ),
partition p27 values ( 27 ),
partition p28 values ( 28 ),
partition p29 values ( 29 ),
partition p30 values ( 30 ),
partition p31 values ( 31 ),
partition p32 values ( 32 ),
partition p33 values ( 33 ),
partition p34 values ( 34 ),
partition p35 values ( 35 ),
partition p36 values ( 36 ),
partition p37 values ( 37 ),
partition p38 values ( 38 ),
partition p39 values ( 39 ),
partition p40 values ( 40 ),
partition p41 values ( 41 ),
partition p42 values ( 42 ),
partition p43 values ( 43 ),
partition p44 values ( 44 ),
partition p45 values ( 45 ),
partition p46 values ( 46 ),
partition p47 values ( 47 ),
partition p48 values ( 48 ),
partition p49 values ( 49 ),
partition p50 values ( 50 ),
partition p51 values ( 51 ),
partition p52 values ( 52 ),
partition p53 values ( 53 ),
partition p54 values ( 54 ),
partition p55 values ( 55 ),
partition p56 values ( 56 ),
partition p57 values ( 57 ),
partition p58 values ( 58 ),
partition p59 values ( 59 ),
partition p60 values ( 60 ),
partition p61 values ( 61 ),
partition p62 values ( 62 ),
partition p63 values ( 63 ),
partition p64 values ( 64 ),
partition p65 values ( 65 ),
partition p66 values ( 66 ),
partition p67 values ( 67 ),
partition p68 values ( 68 ),
partition p69 values ( 69 ),
partition p70 values ( 70 ),
partition p71 values ( 71 ),
partition p72 values ( 72 ),
partition p73 values ( 73 ),
partition p74 values ( 74 ),
partition p75 values ( 75 ),
partition p76 values ( 76 ),
partition p77 values ( 77 ),
partition p78 values ( 78 ),
partition p79 values ( 79 ),
partition p80 values ( 80 ),
partition p81 values ( 81 ),
partition p82 values ( 82 )
);
drop table test_list;
drop schema FVT_COMPRESS_QWER cascade;
NOTICE: drop cascades to 5 other objects
DETAIL: drop cascades to table bmsql_order_line
drop cascades to table test_partition_for_null_list_timestamp

View File

@ -1,25 +1,27 @@
CREATE schema FVT_COMPRESS_QWER;
set search_path to FVT_COMPRESS_QWER;
-- section 1: test from delete.sql
create table delete_test_list (
id int,
a int,
b text
) partition by list(a)
(
partition delete_test_hash_p1 values(1,2,3,4,5,6,7,8,9,10),
partition delete_test_hash_p2 values(11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50),
partition delete_test_hash_p3 values(51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100));
create index delete_test_list_index_local1 on delete_test_list (a) local
(
partition delete_test_list_p1_index_local tablespace PG_DEFAULT,
partition delete_test_list_p2_index_local tablespace PG_DEFAULT,
partition delete_test_list_p3_index_local tablespace PG_DEFAULT
);
INSERT INTO delete_test_list (a) VALUES (10);
INSERT INTO delete_test_list (a, b) VALUES (50, repeat('x', 10000));
INSERT INTO delete_test_list (a) VALUES (100);
SELECT id, a, char_length(b) FROM delete_test_list order by 1, 2, 3;
CREATE schema FVT_COMPRESS_QWER;
set search_path to FVT_COMPRESS_QWER;
-- section 1: test from delete.sql
create table delete_test_list (
id int,
a int,
b text
) partition by list(a)
(
partition delete_test_hash_p1 values(1,2,3,4,5,6,7,8,9,10),
partition delete_test_hash_p2 values(11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50),
partition delete_test_hash_p3 values(51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100));
create index delete_test_list_index_local1 on delete_test_list (a) local
(
partition delete_test_list_p1_index_local tablespace PG_DEFAULT,
partition delete_test_list_p2_index_local tablespace PG_DEFAULT,
partition delete_test_list_p3_index_local tablespace PG_DEFAULT
);
INSERT INTO delete_test_list (a) VALUES (10);
INSERT INTO delete_test_list (a, b) VALUES (50, repeat('x', 10000));
INSERT INTO delete_test_list (a) VALUES (100);
SELECT id, a, char_length(b) FROM delete_test_list order by 1, 2, 3;
id | a | char_length
----+-----+-------------
| 10 |
@ -27,74 +29,85 @@ SELECT id, a, char_length(b) FROM delete_test_list order by 1, 2, 3;
| 100 |
(3 rows)
-- Pseudo Constant Quals
DELETE FROM delete_test_list where null;
-- allow an alias to be specified for DELETE's target table
DELETE FROM delete_test_list AS dt WHERE dt.a > 75;
-- if an alias is specified, don't allow the original table name
-- to be referenced
DELETE FROM delete_test_list dt WHERE dt.a > 25;
SELECT id, a, char_length(b) FROM delete_test_list order by 1, 2, 3;
-- Pseudo Constant Quals
DELETE FROM delete_test_list where null;
-- allow an alias to be specified for DELETE's target table
DELETE FROM delete_test_list AS dt WHERE dt.a > 75;
-- if an alias is specified, don't allow the original table name
-- to be referenced
DELETE FROM delete_test_list dt WHERE dt.a > 25;
SELECT id, a, char_length(b) FROM delete_test_list order by 1, 2, 3;
id | a | char_length
----+----+-------------
| 10 |
(1 row)
-- delete a row with a TOASTed value
DELETE FROM delete_test_list WHERE a > 25;
SELECT id, a, char_length(b) FROM delete_test_list order by 1, 2, 3;
-- delete a row with a TOASTed value
DELETE FROM delete_test_list WHERE a > 25;
SELECT id, a, char_length(b) FROM delete_test_list order by 1, 2, 3;
id | a | char_length
----+----+-------------
| 10 |
(1 row)
DROP TABLE delete_test_list;
-- section 2:
create table hw_list_partition_dml_t1 (id int, name text)partition by list(id) (
partition hw_list_partition_dml_t1_p1 values(1,2,3,4,5,6,7,8,9),
partition hw_list_partition_dml_t1_p2 values(10,11,12,13,14,15,16,17,18,19),
partition hw_list_partition_dml_t1_p3 values(20,21,22,23,24,25,26,27,28,29));
create table hw_list_partition_dml_t2 (id int, name text)partition by list(id) (
partition hw_list_partition_dml_t2_p1 values(1,2,3,4,5,6,7,8,9),
partition hw_list_partition_dml_t2_p2 values(10,11,12,13,14,15,16,17,18,19),
partition hw_list_partition_dml_t2_p3 values(20,21,22,23,24,25,26,27,28,29));
create table hw_list_partition_dml_t3 (id int, name text)partition by list(id) (
partition hw_list_partition_dml_t3_p1 values(1,2,3,4,5,6,7,8,9),
partition hw_list_partition_dml_t3_p2 values(10,11,12,13,14,15,16,17,18,19),
partition hw_list_partition_dml_t3_p3 values(20,21,22,23,24,25,26,27,28,29));
-- section 2.1: two table join, both are partitioned table
insert into hw_list_partition_dml_t1 values (1, 'li'), (11, 'wang'), (21, 'zhang');
insert into hw_list_partition_dml_t2 values (1, 'xi'), (11, 'zhao'), (27, 'qi');
insert into hw_list_partition_dml_t3 values (1, 'qin'), (11, 'he'), (27, 'xiao');
-- delete 10~20 tupes in hw_partition_dml_t1
with T2_ID_10TH AS
(
SELECT id
FROM hw_list_partition_dml_t2
WHERE id >= 10 and id < 20
ORDER BY id
)
delete from hw_list_partition_dml_t1
using hw_list_partition_dml_t2
where hw_list_partition_dml_t1.id < hw_list_partition_dml_t2.id
and hw_list_partition_dml_t2.id IN
(SELECT id FROM T2_ID_10TH)
RETURNING hw_list_partition_dml_t1.name;
DROP TABLE delete_test_list;
-- section 2:
create table hw_list_partition_dml_t1 (id int, name text)partition by list(id) (
partition hw_list_partition_dml_t1_p1 values(1,2,3,4,5,6,7,8,9),
partition hw_list_partition_dml_t1_p2 values(10,11,12,13,14,15,16,17,18,19),
partition hw_list_partition_dml_t1_p3 values(20,21,22,23,24,25,26,27,28,29));
create table hw_list_partition_dml_t2 (id int, name text)partition by list(id) (
partition hw_list_partition_dml_t2_p1 values(1,2,3,4,5,6,7,8,9),
partition hw_list_partition_dml_t2_p2 values(10,11,12,13,14,15,16,17,18,19),
partition hw_list_partition_dml_t2_p3 values(20,21,22,23,24,25,26,27,28,29));
create table hw_list_partition_dml_t3 (id int, name text)partition by list(id) (
partition hw_list_partition_dml_t3_p1 values(1,2,3,4,5,6,7,8,9),
partition hw_list_partition_dml_t3_p2 values(10,11,12,13,14,15,16,17,18,19),
partition hw_list_partition_dml_t3_p3 values(20,21,22,23,24,25,26,27,28,29));
-- section 2.1: two table join, both are partitioned table
insert into hw_list_partition_dml_t1 values (1, 'li'), (11, 'wang'), (21, 'zhang');
insert into hw_list_partition_dml_t2 values (1, 'xi'), (11, 'zhao'), (27, 'qi');
insert into hw_list_partition_dml_t3 values (1, 'qin'), (11, 'he'), (27, 'xiao');
-- delete 10~20 tupes in hw_partition_dml_t1
with T2_ID_10TH AS
(
SELECT id
FROM hw_list_partition_dml_t2
WHERE id >= 10 and id < 20
ORDER BY id
)
delete from hw_list_partition_dml_t1
using hw_list_partition_dml_t2
where hw_list_partition_dml_t1.id < hw_list_partition_dml_t2.id
and hw_list_partition_dml_t2.id IN
(SELECT id FROM T2_ID_10TH)
RETURNING hw_list_partition_dml_t1.name;
name
------
li
(1 row)
select * from hw_list_partition_dml_t1 order by 1, 2;
select * from hw_list_partition_dml_t1 order by 1, 2;
id | name
----+-------
11 | wang
21 | zhang
(2 rows)
-- delete all tupes that is less than 11 in hw_list_partition_dml_t1, that is 3
insert into hw_list_partition_dml_t1 values (3, 'AAA'), (13, 'BBB'), (23, 'CCC'), (24, 'DDD');
select * from hw_list_partition_dml_t1 order by 1, 2;
-- delete all tupes that is less than 11 in hw_list_partition_dml_t1, that is 3
insert into hw_list_partition_dml_t1 values (3, 'AAA'), (13, 'BBB'), (23, 'CCC'), (24, 'DDD');
select * from hw_list_partition_dml_t1 order by 1, 2;
id | name
----+-------
3 | AAA
@ -105,13 +118,13 @@ select * from hw_list_partition_dml_t1 order by 1, 2;
24 | DDD
(6 rows)
delete from hw_list_partition_dml_t1 using hw_list_partition_dml_t2 where hw_list_partition_dml_t1.id < hw_list_partition_dml_t2.id and hw_list_partition_dml_t2.id = 11 RETURNING hw_list_partition_dml_t1.id;
delete from hw_list_partition_dml_t1 using hw_list_partition_dml_t2 where hw_list_partition_dml_t1.id < hw_list_partition_dml_t2.id and hw_list_partition_dml_t2.id = 11 RETURNING hw_list_partition_dml_t1.id;
id
----
3
(1 row)
select * from hw_list_partition_dml_t1 order by 1, 2;
select * from hw_list_partition_dml_t1 order by 1, 2;
id | name
----+-------
11 | wang
@ -121,19 +134,21 @@ select * from hw_list_partition_dml_t1 order by 1, 2;
24 | DDD
(5 rows)
-- section 2.2: delete from only one table, no joining
-- delete all tupes remaining: 13, 23, 24
delete from hw_list_partition_dml_t1;
select * from hw_list_partition_dml_t1 order by 1, 2;
-- section 2.2: delete from only one table, no joining
-- delete all tupes remaining: 13, 23, 24
delete from hw_list_partition_dml_t1;
select * from hw_list_partition_dml_t1 order by 1, 2;
id | name
----+------
(0 rows)
-- section 3:
-- section 3.1: two table join, only one is partitioned table
-- and target relation is partitioned
insert into hw_list_partition_dml_t1 values (1, 'AAA'), (11, 'BBB'), (21, 'CCC');
select * from hw_list_partition_dml_t1 order by 1, 2;
-- section 3:
-- section 3.1: two table join, only one is partitioned table
-- and target relation is partitioned
insert into hw_list_partition_dml_t1 values (1, 'AAA'), (11, 'BBB'), (21, 'CCC');
select * from hw_list_partition_dml_t1 order by 1, 2;
id | name
----+------
1 | AAA
@ -141,16 +156,16 @@ select * from hw_list_partition_dml_t1 order by 1, 2;
21 | CCC
(3 rows)
-- delete all tupes in hw_list_partition_dml_t1
delete from hw_list_partition_dml_t1 using hw_list_partition_dml_t3 where hw_list_partition_dml_t1.id < hw_list_partition_dml_t3.id and hw_list_partition_dml_t3.id = 27;
select * from hw_list_partition_dml_t1 order by 1, 2;
-- delete all tupes in hw_list_partition_dml_t1
delete from hw_list_partition_dml_t1 using hw_list_partition_dml_t3 where hw_list_partition_dml_t1.id < hw_list_partition_dml_t3.id and hw_list_partition_dml_t3.id = 27;
select * from hw_list_partition_dml_t1 order by 1, 2;
id | name
----+------
(0 rows)
-- delete all tupes that is less than 11 in hw_list_partition_dml_t1, that is 3
insert into hw_list_partition_dml_t1 values (3, 'AAA'), (13, 'BBB'), (23, 'CCC'), (24, 'DDD');
select * from hw_list_partition_dml_t1 order by 1, 2;
-- delete all tupes that is less than 11 in hw_list_partition_dml_t1, that is 3
insert into hw_list_partition_dml_t1 values (3, 'AAA'), (13, 'BBB'), (23, 'CCC'), (24, 'DDD');
select * from hw_list_partition_dml_t1 order by 1, 2;
id | name
----+------
3 | AAA
@ -159,8 +174,8 @@ select * from hw_list_partition_dml_t1 order by 1, 2;
24 | DDD
(4 rows)
delete from hw_list_partition_dml_t1 using hw_list_partition_dml_t3 where hw_list_partition_dml_t1.id < hw_list_partition_dml_t3.id and hw_list_partition_dml_t3.id = 11;
select * from hw_list_partition_dml_t1 order by 1, 2;
delete from hw_list_partition_dml_t1 using hw_list_partition_dml_t3 where hw_list_partition_dml_t1.id < hw_list_partition_dml_t3.id and hw_list_partition_dml_t3.id = 11;
select * from hw_list_partition_dml_t1 order by 1, 2;
id | name
----+------
13 | BBB
@ -168,28 +183,31 @@ select * from hw_list_partition_dml_t1 order by 1, 2;
24 | DDD
(3 rows)
-- section 3.2 delete from only one table, no joining
-- delete all tupes remaining: 13, 23, 24
delete from hw_list_partition_dml_t1;
select * from hw_list_partition_dml_t1 order by 1, 2;
-- section 3.2 delete from only one table, no joining
-- delete all tupes remaining: 13, 23, 24
delete from hw_list_partition_dml_t1;
select * from hw_list_partition_dml_t1 order by 1, 2;
id | name
----+------
(0 rows)
-- section 3.3: two table join, only one is partitioned table
-- and target relation is on-partitioned
-- delete all tuples in hw_list_partition_dml_t3
insert into hw_list_partition_dml_t2 values (28, 'EEE');
delete from hw_list_partition_dml_t3 using hw_list_partition_dml_t2 where hw_list_partition_dml_t3.id < hw_list_partition_dml_t2.id and hw_list_partition_dml_t2.id = 28;
select * from hw_list_partition_dml_t3 order by 1, 2;
-- section 3.3: two table join, only one is partitioned table
-- and target relation is on-partitioned
-- delete all tuples in hw_list_partition_dml_t3
insert into hw_list_partition_dml_t2 values (28, 'EEE');
delete from hw_list_partition_dml_t3 using hw_list_partition_dml_t2 where hw_list_partition_dml_t3.id < hw_list_partition_dml_t2.id and hw_list_partition_dml_t2.id = 28;
select * from hw_list_partition_dml_t3 order by 1, 2;
id | name
----+------
(0 rows)
-- delete all tuples that is less than 11 in hw_list_partition_dml_t3, that is 3
insert into hw_list_partition_dml_t3 values (3, 'AAA'), (13, 'BBB'), (23, 'CCC'), (24, 'DDD');
delete from hw_list_partition_dml_t3 using hw_list_partition_dml_t2 where hw_list_partition_dml_t3.id < hw_list_partition_dml_t2.id and hw_list_partition_dml_t2.id = 11;
select * from hw_list_partition_dml_t3 order by 1, 2;
-- delete all tuples that is less than 11 in hw_list_partition_dml_t3, that is 3
insert into hw_list_partition_dml_t3 values (3, 'AAA'), (13, 'BBB'), (23, 'CCC'), (24, 'DDD');
delete from hw_list_partition_dml_t3 using hw_list_partition_dml_t2 where hw_list_partition_dml_t3.id < hw_list_partition_dml_t2.id and hw_list_partition_dml_t2.id = 11;
select * from hw_list_partition_dml_t3 order by 1, 2;
id | name
----+------
13 | BBB
@ -197,28 +215,31 @@ select * from hw_list_partition_dml_t3 order by 1, 2;
24 | DDD
(3 rows)
-- section 3.4 delete from only one table, no joining
-- delete all tuples remaining: 13, 23, 24
delete from hw_list_partition_dml_t3;
select * from hw_list_partition_dml_t3 order by 1, 2;
-- section 3.4 delete from only one table, no joining
-- delete all tuples remaining: 13, 23, 24
delete from hw_list_partition_dml_t3;
select * from hw_list_partition_dml_t3 order by 1, 2;
id | name
----+------
(0 rows)
-- finally, drop table hw_list_partition_dml_t1, hw_list_partition_dml_t2 and hw_list_partition_dml_t3
drop table hw_list_partition_dml_t1;
drop table hw_list_partition_dml_t2;
drop table hw_list_partition_dml_t3;
drop table test_index_lt;
-- finally, drop table hw_list_partition_dml_t1, hw_list_partition_dml_t2 and hw_list_partition_dml_t3
drop table hw_list_partition_dml_t1;
drop table hw_list_partition_dml_t2;
drop table hw_list_partition_dml_t3;
drop table test_index_lt;
ERROR: table "test_index_lt" does not exist
create table test_index_lt (a int, b int, c int)
partition by list(a)
(
PARTITION p1 VALUES (3, 4, 5),
PARTITION p2 VALUES (1, 2)
);
insert into test_index_lt select generate_series(1,4);
explain (costs off, verbose on) select * from test_index_lt order by 1;
create table test_index_lt (a int, b int, c int)
partition by list(a)
(
PARTITION p1 VALUES (3, 4, 5),
PARTITION p2 VALUES (1, 2)
);
insert into test_index_lt select generate_series(1,4);
explain (costs off, verbose on) select * from test_index_lt order by 1;
QUERY PLAN
---------------------------------------------------------------------
Sort
@ -232,7 +253,7 @@ explain (costs off, verbose on) select * from test_index_lt order by 1;
Selected Partitions: 1..2
(9 rows)
select * from test_index_lt order by 1;
select * from test_index_lt order by 1;
a | b | c
---+---+---
1 | |
@ -241,10 +262,10 @@ select * from test_index_lt order by 1;
4 | |
(4 rows)
create index test_exchange_index_lt_a on test_index_lt (a) local;
set enable_seqscan = off;
set enable_bitmapscan = off;
explain (costs off, verbose on) select * from test_index_lt order by 1;
create index test_exchange_index_lt_a on test_index_lt (a) local;
set enable_seqscan = off;
set enable_bitmapscan = off;
explain (costs off, verbose on) select * from test_index_lt order by 1;
QUERY PLAN
------------------------------------------------------------------------------------------------------
Sort
@ -258,7 +279,7 @@ explain (costs off, verbose on) select * from test_index_lt order by 1;
Selected Partitions: 1..2
(9 rows)
select * from test_index_lt order by 1;
select * from test_index_lt order by 1;
a | b | c
---+---+---
1 | |
@ -267,25 +288,27 @@ select * from test_index_lt order by 1;
4 | |
(4 rows)
drop table test_index_lt;
drop schema FVT_COMPRESS_QWER cascade;
create schema fvt_other_cmd;
CREATE TABLE FVT_OTHER_CMD.IDEX_LIST_PARTITION_TABLE_001(COL_INT int)
partition by list (COL_INT)
(
partition IDEX_LIST_PARTITION_TABLE_001_1 values (1000,2000),
partition IDEX_LIST_PARTITION_TABLE_001_2 values (3000,4000,5000),
partition IDEX_LIST_PARTITION_TABLE_001_3 values (6000,7000,8000,9000,10000)
);
declare
i int;
begin i:=1;
while
i<9990 LOOP
Delete from FVT_OTHER_CMD.IDEX_LIST_PARTITION_TABLE_001 where col_int=i;
i:=i+1000;
end loop;
end;
/
drop schema fvt_other_cmd cascade;
drop table test_index_lt;
drop schema FVT_COMPRESS_QWER cascade;
create schema fvt_other_cmd;
CREATE TABLE FVT_OTHER_CMD.IDEX_LIST_PARTITION_TABLE_001(COL_INT int)
partition by list (COL_INT)
(
partition IDEX_LIST_PARTITION_TABLE_001_1 values (1000,2000),
partition IDEX_LIST_PARTITION_TABLE_001_2 values (3000,4000,5000),
partition IDEX_LIST_PARTITION_TABLE_001_3 values (6000,7000,8000,9000,10000)
);
declare
i int;
begin i:=1;
while
i<9990 LOOP
Delete from FVT_OTHER_CMD.IDEX_LIST_PARTITION_TABLE_001 where col_int=i;
i:=i+1000;
end loop;
end;
/
drop schema fvt_other_cmd cascade;
NOTICE: drop cascades to table fvt_other_cmd.idex_list_partition_table_001

View File

@ -1,8 +1,6 @@
--
---- test partition for (null)
--
-- 1. test ordinary
-- 1.1 range partitioned table
-- 1.2 interval partitioned table
@ -12,11 +10,8 @@
-- 3. MAXVALUE
-- 3.1 MAXVALUE is first column
-- 3.2 MAXVALUE is second column
CREATE schema FVT_COMPRESS_QWER;
set search_path to FVT_COMPRESS_QWER;
-- 1. test ordinary
---- 1.1 range partitioned table
create table test_partition_for_null_list (a int, b int, c int, d int)
@ -26,18 +21,14 @@ partition by list (a)
partition test_partition_for_null_list_p2 values(1,2,3),
partition test_partition_for_null_list_p3 values(4,5,6)
);
insert into test_partition_for_null_list values (0, 0, 0, 0);
insert into test_partition_for_null_list values (1, 1, 1, 1);
insert into test_partition_for_null_list values (5, 5, 5, 5);
-- failed: inserted partition key does not map to any table partition
insert into test_partition_for_null_list values (null, null, null, null);
ERROR: inserted partition key does not map to any table partition
-- success
insert into test_partition_for_null_list values (0, null, null, null);
-- failed: The partition number is invalid or out-of-range
select * from test_partition_for_null_list partition for (null) order by 1, 2, 3, 4;
ERROR: Cannot find partition by the value
@ -50,8 +41,6 @@ select * from test_partition_for_null_list partition for (0) order by 1, 2, 3, 4
0 | | |
(2 rows)
-- failed: The partition number is invalid or out-of-range
alter table test_partition_for_null_list rename partition for (null) to test_partition_for_null_list_part1;
ERROR: The partition number is invalid or out-of-range
@ -65,8 +54,6 @@ select * from test_partition_for_null_list partition (test_partition_for_null_li
0 | | |
(2 rows)
-- failed: The partition number is invalid or out-of-range
alter table test_partition_for_null_list drop partition for (null);
ERROR: The partition number is invalid or out-of-range
@ -75,7 +62,6 @@ alter table test_partition_for_null_list drop partition for (0);
-- failed
select * from test_partition_for_null_list partition (test_partition_for_null_list_part1) order by 1, 2, 3, 4;
ERROR: partition "test_partition_for_null_list_part1" of relation "test_partition_for_null_list" does not exist
CREATE TABLE select_list_partition_table_000_3(
C_CHAR_1 CHAR(1),
C_CHAR_2 CHAR(10),
@ -97,10 +83,8 @@ CREATE TABLE select_list_partition_table_000_3(
partition select_list_partition_000_3_1 values (111,222,333,444),
partition select_list_partition_000_3_2 values (555,666,777,888,999,1100,1600)
);
create index select_list_partition_table_index_000_3 ON select_list_partition_table_000_3(C_CHAR_3,C_VARCHAR_3,C_INT,C_TS_WITHOUT) local(partition select_list_partition_000_3_1, partition select_list_partition_000_3_3);
create view select_list_partition_table_view_000_3 as select * from select_list_partition_table_000_3;
INSERT INTO select_list_partition_table_000_3 VALUES('A','ABC','ABCDEFG','a','abc','abcdefg',111,111111,11,1.1,1.11,1.111,'2000-01-01','2000-01-01 01:01:01','2000-01-01 01:01:01+01');
INSERT INTO select_list_partition_table_000_3 VALUES('B','BCD','BCDEFGH','b','bcd','bcdefgh',222,222222,22,2.2,2.22,2.222,'2000-02-02','2000-02-02 02:02:02','2000-02-02 02:02:02+02');
INSERT INTO select_list_partition_table_000_3 VALUES('C','CDE','CDEFGHI','c','cde','cdefghi',333,333333,33,3.3,3.33,3.333,'2000-03-03','2000-03-03 03:03:03','2000-03-03 03:03:03+03');
@ -114,49 +98,38 @@ INSERT INTO select_list_partition_table_000_3 VALUES('H','HIJ','HIJKLMN','h','hi
INSERT INTO select_list_partition_table_000_3 VALUES('I','IJK','IJKLMNO','i','ijk','ijklmno',999,999999,99,9.9,9.99,9.999,'2000-09-09','2000-09-09 09:09:09','2000-09-09 09:09:09+09');
INSERT INTO select_list_partition_table_000_3 VALUES('I','IJK','IJKLMNO','i','ijk','ijklmno',1100,999999,99,9.9,9.99,9.999,'2000-09-09','2000-09-09 09:09:09','2000-09-09 09:09:09+09');
INSERT INTO select_list_partition_table_000_3 VALUES('I','IJK','IJKLMNO','i','ijk','ijklmno',1600,999999,99,9.9,9.99,9.999,'2000-09-09','2000-09-09 09:09:09','2000-09-09 09:09:09+09');
select * from select_list_partition_table_000_3 partition for (NULL) order by C_INT;
ERROR: Cannot find partition by the value
DETAIL: N/A.
alter table select_list_partition_table_000_3 rename partition for (NULL) to select_list_partition_table_000_3_p1;
ERROR: The partition number is invalid or out-of-range
alter table select_list_partition_table_000_3 drop partition for (NULL);
ERROR: Cannot perform this operation because There are views or rules that depend on table select_list_partition_table_000_3.
DETAIL: N/A
HINT: drop the views or rules first. Use pg_rules to find rules. Use pg_class, pg_rewrite, pg_depend, pg_namespacesql to find views
CREATE TABLE partition_wise_join_table_001_1 (ID INT NOT NULL,NAME VARCHAR(50) NOT NULL,SCORE NUMERIC(4,1),BIRTHDAY TIMESTAMP WITHOUT TIME ZONE,ADDRESS TEXT,SALARY double precision,RANK SMALLINT)
partition by list(ID)
(
partition partition_wise_join_table_001_1_1 values (1,42,3,44,5,46,7,48,9),
partition partition_wise_join_table_001_1_2 values (41,2,43,4,45,6,47,8,49)
) ;
INSERT INTO partition_wise_join_table_001_1 VALUES (generate_series(1,9),'PARTITION WIASE JOIN 1-1-' || generate_series(1,10),90 + random() * 10,'1990-8-8',$$No.88# Science 6 Street of Xi'an of China $$,10000,13 );
INSERT INTO partition_wise_join_table_001_1 VALUES (generate_series(41,49),'PARTITION WIASE JOIN 1-3-' || generate_series(40,60),90 + random() * 10,'1990-8-8',$$No.88# Science 6 Street of Xi'an of China $$,15000,15 );
create index idx_partition_wise_join_table_001_1_1 on partition_wise_join_table_001_1(ID) LOCAL;
create index idx_partition_wise_join_table_001_1_2 on partition_wise_join_table_001_1(ID,NAME) LOCAL;
create index idx_partition_wise_join_table_001_1_3 on partition_wise_join_table_001_1(RANK) LOCAL;
create index idx_partition_wise_join_table_001_1_4 on partition_wise_join_table_001_1(RANK,SALARY,NAME) LOCAL;
CREATE TABLE partition_wise_join_table_001_2 (ID INT NOT NULL,NAME VARCHAR(50) NOT NULL,SCORE NUMERIC(4,1),BIRTHDAY TIMESTAMP WITHOUT TIME ZONE,ADDRESS TEXT,SALARY double precision )
partition by list(ID)
(
partition partition_wise_join_table_001_1_1 values (71,2,73,4,75,6,77,8,79),
partition partition_wise_join_table_001_1_2 values (1,72,3,74,5,76,7,78,9)
);
INSERT INTO partition_wise_join_table_001_2 VALUES (generate_series(1,9),'PARTITION WIASE JOIN 2-1-' || generate_series(1,10),90 + random() * 10,'1990-8-8',$$No 66# Science 4 Street of Xi'an of China $$,10000);
INSERT INTO partition_wise_join_table_001_2 VALUES (generate_series(71,79),'PARTITION WIASE JOIN 2-3-' || generate_series(70,80),90 + random() * 10,'1990-8-8',$$No 77# Science 4 Street of Xi'an of China $$,15000);
CREATE INDEX IDX_PARTITION_WISE_JOIN_TABLE_001_2_1 ON PARTITION_WISE_JOIN_TABLE_001_2(ID) LOCAL;
CREATE INDEX IDX_PARTITION_WISE_JOIN_TABLE_001_2_2 ON PARTITION_WISE_JOIN_TABLE_001_2(ID,NAME) LOCAL;
CREATE INDEX IDX_PARTITION_WISE_JOIN_TABLE_001_2_3 ON PARTITION_WISE_JOIN_TABLE_001_2(SALARY,NAME) LOCAL;
SELECT A.ID,B.ID, A.RANK,B.SALARY,A.SALARY,A.ADDRESS,B.BIRTHDAY FROM PARTITION_WISE_JOIN_TABLE_001_1 A,PARTITION_WISE_JOIN_TABLE_001_2 B WHERE A.ID = B.ID AND A.ID < 100 OR A.ID >400 order by 1, 2;
id | id | rank | salary | salary | address | birthday
----+----+------+--------+--------+----------------------------------------------+--------------------------
@ -1062,10 +1035,8 @@ SELECT A.ID,B.ID, A.RANK,B.SALARY,A.SALARY,A.ADDRESS,B.BIRTHDAY FROM PARTITION_W
9 | 9 | 13 | 10000 | 10000 | No.88# Science 6 Street of Xi'an of China | Wed Aug 08 00:00:00 1990
(900 rows)
ANALYZE PARTITION_WISE_JOIN_TABLE_001_1;
ANALYZE PARTITION_WISE_JOIN_TABLE_001_2;
SELECT A.ID,B.ID, A.RANK,B.SALARY,A.SALARY,A.ADDRESS,B.BIRTHDAY FROM PARTITION_WISE_JOIN_TABLE_001_1 A,PARTITION_WISE_JOIN_TABLE_001_2 B WHERE A.ID = B.ID AND A.ID < 100 OR A.ID >400 order by 1, 2;
id | id | rank | salary | salary | address | birthday
----+----+------+--------+--------+----------------------------------------------+--------------------------
@ -1971,7 +1942,6 @@ SELECT A.ID,B.ID, A.RANK,B.SALARY,A.SALARY,A.ADDRESS,B.BIRTHDAY FROM PARTITION_W
9 | 9 | 13 | 10000 | 10000 | No.88# Science 6 Street of Xi'an of China | Wed Aug 08 00:00:00 1990
(900 rows)
CREATE TABLE HW_PARTITION_SELECT_RT (A INT, B INT)
PARTITION BY list (A)
(
@ -1991,7 +1961,6 @@ EXPLAIN (COSTS OFF) SELECT B FROM (SELECT B FROM HW_PARTITION_SELECT_RT LIMIT 10
Selected Partitions: 1..3
(7 rows)
CREATE TABLE TESTTABLE_TEST1(A INT) PARTITION BY LIST (A)(PARTITION TESTTABLE_TEST1_P1 VALUES (1,2,3,4,5,6,7,8,9));
CREATE TABLE TESTTABLE_TEST2(A INT);
SELECT * FROM TESTTABLE_TEST1 UNION ALL SELECT * FROM TESTTABLE_TEST2 order by 1;
@ -1999,7 +1968,6 @@ SELECT * FROM TESTTABLE_TEST1 UNION ALL SELECT * FROM TESTTABLE_TEST2 order by 1
---
(0 rows)
CREATE TABLE select_partition_table_000_3(
C_CHAR_1 CHAR(1),
C_CHAR_2 CHAR(10),
@ -2021,10 +1989,8 @@ CREATE TABLE select_partition_table_000_3(
partition select_partition_000_3_1 values (111,222,333,444),
partition select_partition_000_3_3 values (555,666,777,888,999,1100,1600)
);
create index select_partition_table_index_000_3 ON select_partition_table_000_3(C_CHAR_3,C_VARCHAR_3,C_INT,C_TS_WITHOUT) local(partition select_partition_000_3_1, partition select_partition_000_3_3);
create view select_partition_table_view_000_3 as select * from select_partition_table_000_3;
INSERT INTO select_partition_table_000_3 VALUES('A','ABC','ABCDEFG','a','abc','abcdefg',111,111111,11,1.1,1.11,1.111,'2000-01-01','2000-01-01 01:01:01','2000-01-01 01:01:01+01');
INSERT INTO select_partition_table_000_3 VALUES('B','BCD','BCDEFGH','b','bcd','bcdefgh',222,222222,22,2.2,2.22,2.222,'2000-02-02','2000-02-02 02:02:02','2000-02-02 02:02:02+02');
INSERT INTO select_partition_table_000_3 VALUES('C','CDE','CDEFGHI','c','cde','cdefghi',333,333333,33,3.3,3.33,3.333,'2000-03-03','2000-03-03 03:03:03','2000-03-03 03:03:03+03');
@ -2038,7 +2004,6 @@ INSERT INTO select_partition_table_000_3 VALUES('H','HIJ','HIJKLMN','h','hij','h
INSERT INTO select_partition_table_000_3 VALUES('I','IJK','IJKLMNO','i','ijk','ijklmno',999,999999,99,9.9,9.99,9.999,'2000-09-09','2000-09-09 09:09:09','2000-09-09 09:09:09+09');
INSERT INTO select_partition_table_000_3 VALUES('I','IJK','IJKLMNO','i','ijk','ijklmno',1100,999999,99,9.9,9.99,9.999,'2000-09-09','2000-09-09 09:09:09','2000-09-09 09:09:09+09');
INSERT INTO select_partition_table_000_3 VALUES('I','IJK','IJKLMNO','i','ijk','ijklmno',1600,999999,99,9.9,9.99,9.999,'2000-09-09','2000-09-09 09:09:09','2000-09-09 09:09:09+09');
explain (costs off, verbose on) select lower(C_CHAR_3), initcap(C_VARCHAR_3), sqrt(C_INT), C_NUMERIC- 1 + 2*6/3, rank() over w from select_partition_table_000_3 where C_INT > 600 or C_BIGINT < 444444 window w as (partition by C_TS_WITHOUT) order by 1,2,3,4,5;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@ -2059,7 +2024,6 @@ explain (costs off, verbose on) select lower(C_CHAR_3), initcap(C_VARCHAR_3), sq
Selected Partitions: 1..2
(15 rows)
select lower(C_CHAR_3), initcap(C_VARCHAR_3), sqrt(C_INT), C_NUMERIC- 1 + 2*6/3, rank() over w from select_partition_table_000_3 where C_INT > 600 or C_BIGINT < 444444 window w as (partition by C_TS_WITHOUT) order by 1,2,3,4,5;
lower | initcap | sqrt | ?column? | rank
---------+---------+------------------+----------+------
@ -2076,17 +2040,13 @@ select lower(C_CHAR_3), initcap(C_VARCHAR_3), sqrt(C_INT), C_NUMERIC- 1 + 2*6/3,
ijklmno | Ijklmno | 40 | 12.99 | 1
(11 rows)
create table hw_partition_select_rt5 (a int, b int, c int)
partition by list(c)
(
partition hw_partition_select_rt5_p1 values (0,1)
);
alter table hw_partition_select_rt5 drop column b;
update hw_partition_select_rt5 set c=0 where c=-1;
drop schema FVT_COMPRESS_QWER cascade;
NOTICE: drop cascades to 11 other objects
DETAIL: drop cascades to table test_partition_for_null_list
@ -2100,7 +2060,6 @@ drop cascades to table testtable_test2
drop cascades to table select_partition_table_000_3
drop cascades to view select_partition_table_view_000_3
drop cascades to table hw_partition_select_rt5
--begin: these test are related to explain output change about partition table.
-- major change is as below
--1.
@ -2113,8 +2072,6 @@ drop cascades to table hw_partition_select_rt5
--Selected Partitions: 1,3,5,7,9
CREATE schema FVT_COMPRESS;
set search_path to FVT_COMPRESS;
create table test_explain_format_on_part_table (id int)
partition by list(id)
(
@ -2212,10 +2169,8 @@ explain (verbose on, costs off, FORMAT JSON)
]
(1 row)
drop table test_explain_format_on_part_table;
--end: these test are related to explain output change about partition table.
create table hw_partition_select_parttable (
c1 int,
c2 int,
@ -2237,7 +2192,6 @@ select * from hw_partition_select_parttable order by 1, 2, 3;
300 | 200 |
(3 rows)
select c1 from hw_partition_select_parttable order by 1;
c1
-----
@ -2246,7 +2200,6 @@ select c1 from hw_partition_select_parttable order by 1;
300
(3 rows)
select c1,c2 from hw_partition_select_parttable order by 1, 2;
c1 | c2
-----+-----
@ -2255,7 +2208,6 @@ select c1,c2 from hw_partition_select_parttable order by 1, 2;
300 | 200
(3 rows)
select c2 from hw_partition_select_parttable order by 1;
c2
-----
@ -2264,7 +2216,6 @@ select c2 from hw_partition_select_parttable order by 1;
200
(3 rows)
select c1,c2,c3 from hw_partition_select_parttable order by 1, 2, 3;
c1 | c2 | c3
-----+-----+-----
@ -2273,21 +2224,18 @@ select c1,c2,c3 from hw_partition_select_parttable order by 1, 2, 3;
300 | 200 |
(3 rows)
select c1 from hw_partition_select_parttable where c1>50 and c1<300 order by 1;
c1
-----
100
(1 row)
select * from hw_partition_select_parttable where c2>100 order by 1, 2, 3;
c1 | c2 | c3
-----+-----+----
300 | 200 |
(1 row)
create table t_select_datatype_int32(c1 int,c2 int,c3 int,c4 text)
partition by list(c1)
(partition t_select_datatype_int32_p1 values(-100, -50, 0, 50),
@ -2296,7 +2244,6 @@ partition by list(c1)
partition t_select_datatype_int32_p4 values(400, 450, 500));
insert into t_select_datatype_int32 values(-100,20,20,'a'), (100,300,300,'bb'), (150,75,500,NULL), (200,500,50,'ccc'), (250,50,50,NULL), (300,700,125,''), (450,35,150,'dddd');
--partition select for int32
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1=50 order by 1, 2, 3, 4;
@ -2304,7 +2251,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1=50 order
----+----+----+----
(0 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1=100 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2312,7 +2258,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1=100 order
100 | 300 | 300 | bb
(1 row)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1=250 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2320,21 +2265,18 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1=250 order
250 | 50 | 50 |
(1 row)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1=500 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
----+----+----+----
(0 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1=550 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
----+----+----+----
(0 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2342,7 +2284,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 order
-100 | 20 | 20 | a
(1 row)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<=50 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2350,7 +2291,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<=50 order
-100 | 20 | 20 | a
(1 row)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<100 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2358,7 +2298,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<100 order
-100 | 20 | 20 | a
(1 row)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<=100 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2367,7 +2306,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<=100 orde
100 | 300 | 300 | bb
(2 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<150 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2376,7 +2314,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<150 order
100 | 300 | 300 | bb
(2 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<200 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2386,7 +2323,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<200 order
150 | 75 | 500 |
(3 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<=200 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2397,7 +2333,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<=200 orde
200 | 500 | 50 | ccc
(4 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<500 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2411,7 +2346,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<500 order
450 | 35 | 150 | dddd
(7 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<=500 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2425,7 +2359,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<=500 orde
450 | 35 | 150 | dddd
(7 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<700 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2439,7 +2372,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<700 order
450 | 35 | 150 | dddd
(7 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<=700 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2453,7 +2385,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<=700 orde
450 | 35 | 150 | dddd
(7 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>50 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2466,7 +2397,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>50 order
450 | 35 | 150 | dddd
(6 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=50 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2479,7 +2409,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=50 order
450 | 35 | 150 | dddd
(6 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>100 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2491,7 +2420,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>100 order
450 | 35 | 150 | dddd
(5 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=100 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2504,7 +2432,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=100 orde
450 | 35 | 150 | dddd
(6 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>150 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2515,7 +2442,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>150 order
450 | 35 | 150 | dddd
(4 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=150 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2527,7 +2453,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=150 orde
450 | 35 | 150 | dddd
(5 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>200 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2537,7 +2462,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>200 order
450 | 35 | 150 | dddd
(3 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=200 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2548,21 +2472,18 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=200 orde
450 | 35 | 150 | dddd
(4 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>500 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
----+----+----+----
(0 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=500 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
----+----+----+----
(0 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 AND t_select_datatype_int32.c1<250 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2570,21 +2491,18 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 AND t_
-100 | 20 | 20 | a
(1 row)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 AND t_select_datatype_int32.c1>0 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
----+----+----+----
(0 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 AND t_select_datatype_int32.c1>100 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
----+----+----+----
(0 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>50 AND t_select_datatype_int32.c1>=150 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2596,7 +2514,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>50 AND t_
450 | 35 | 150 | dddd
(5 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>100 AND t_select_datatype_int32.c1>=100 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2608,7 +2525,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>100 AND t
450 | 35 | 150 | dddd
(5 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=100 AND t_select_datatype_int32.c1=100 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2616,7 +2532,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=100 AND
100 | 300 | 300 | bb
(1 row)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=100 AND t_select_datatype_int32.c1<300 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2627,7 +2542,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=100 AND
250 | 50 | 50 |
(4 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=100 AND t_select_datatype_int32.c1<550 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2640,7 +2554,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=100 AND
450 | 35 | 150 | dddd
(6 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>100 AND t_select_datatype_int32.c1<=500 AND t_select_datatype_int32.c1>=100 AND t_select_datatype_int32.c1<500 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2652,14 +2565,12 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>100 AND t
450 | 35 | 150 | dddd
(5 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>250 AND t_select_datatype_int32.c1<50 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
----+----+----+----
(0 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>50 AND t_select_datatype_int32.c1>100 AND t_select_datatype_int32.c1>=100 AND t_select_datatype_int32.c1<250 AND t_select_datatype_int32.c1<=250 AND t_select_datatype_int32.c1=200 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2667,7 +2578,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>50 AND t_
200 | 500 | 50 | ccc
(1 row)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 OR t_select_datatype_int32.c1<250 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2678,7 +2588,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 OR t_s
200 | 500 | 50 | ccc
(4 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 OR t_select_datatype_int32.c1>0 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2692,7 +2601,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 OR t_s
450 | 35 | 150 | dddd
(7 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 OR t_select_datatype_int32.c1>100 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2705,7 +2613,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 OR t_s
450 | 35 | 150 | dddd
(6 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>50 OR t_select_datatype_int32.c1>=150 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2718,7 +2625,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>50 OR t_s
450 | 35 | 150 | dddd
(6 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>100 OR t_select_datatype_int32.c1>=100 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2731,7 +2637,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>100 OR t_
450 | 35 | 150 | dddd
(6 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=100 OR t_select_datatype_int32.c1=100 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2744,7 +2649,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=100 OR t
450 | 35 | 150 | dddd
(6 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=100 OR t_select_datatype_int32.c1<200 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2758,7 +2662,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=100 OR t
450 | 35 | 150 | dddd
(7 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>500 OR t_select_datatype_int32.c1<250 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2769,7 +2672,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>500 OR t_
200 | 500 | 50 | ccc
(4 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>100 OR t_select_datatype_int32.c1<=300 OR t_select_datatype_int32.c1>=100 OR t_select_datatype_int32.c1<300 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2783,7 +2685,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>100 OR t_
450 | 35 | 150 | dddd
(7 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>250 OR t_select_datatype_int32.c1<50 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2793,7 +2694,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>250 OR t_
450 | 35 | 150 | dddd
(3 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<170 AND ( t_select_datatype_int32.c1>600 OR t_select_datatype_int32.c1<150) order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2802,7 +2702,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<170 AND
100 | 300 | 300 | bb
(2 rows)
--success
select * from t_select_datatype_int32 where (t_select_datatype_int32.c1<170 OR t_select_datatype_int32.c1<250) AND ( t_select_datatype_int32.c1>600 OR t_select_datatype_int32.c1<150) order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2811,7 +2710,6 @@ select * from t_select_datatype_int32 where (t_select_datatype_int32.c1<170 OR t
100 | 300 | 300 | bb
(2 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 OR t_select_datatype_int32.c1>250 AND t_select_datatype_int32.c1<400 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2820,7 +2718,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1<50 OR t_s
300 | 700 | 125 |
(2 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=-100 AND t_select_datatype_int32.c1<50 OR t_select_datatype_int32.c1>300 AND t_select_datatype_int32.c1<700 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2829,7 +2726,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=-100 AND
450 | 35 | 150 | dddd
(2 rows)
--success
select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=-100 AND t_select_datatype_int32.c1<=100 OR t_select_datatype_int32.c1>300 AND t_select_datatype_int32.c1<700 order by 1, 2, 3, 4;
c1 | c2 | c3 | c4
@ -2839,7 +2735,6 @@ select * from t_select_datatype_int32 where t_select_datatype_int32.c1>=-100 AND
450 | 35 | 150 | dddd
(3 rows)
--IS NULL
--success
select * from t_select_datatype_int32 where
@ -2855,7 +2750,6 @@ select * from t_select_datatype_int32 where
300 | 700 | 125 |
(3 rows)
--success
select * from t_select_datatype_int32 where
(t_select_datatype_int32.c1>500 OR t_select_datatype_int32.c1<250) AND
@ -2867,7 +2761,6 @@ select * from t_select_datatype_int32 where
----+----+----+----
(0 rows)
--success
select * from t_select_datatype_int32 where
t_select_datatype_int32.c4 IS NULL AND
@ -2879,7 +2772,6 @@ select * from t_select_datatype_int32 where
----+----+----+----
(0 rows)
--success
select * from t_select_datatype_int32 where
t_select_datatype_int32.c4 IS NULL OR
@ -2894,7 +2786,6 @@ select * from t_select_datatype_int32 where
300 | 700 | 125 |
(3 rows)
--success
select * from t_select_datatype_int32 where
(t_select_datatype_int32.c1>500 OR t_select_datatype_int32.c1<250) AND
@ -2905,7 +2796,6 @@ select * from t_select_datatype_int32 where
----+----+----+----
(0 rows)
--success
select * from t_select_datatype_int32 where
(t_select_datatype_int32.c1>500 OR t_select_datatype_int32.c1<250) AND
@ -2916,16 +2806,12 @@ select * from t_select_datatype_int32 where
----+----+----+----
(0 rows)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- check select contarins partition
--
---- check select from range partition
--
create table hw_partition_select_ordinary_table (a int, b int);
create table test_select_list_partition (a int, b int)
partition by list(a)
(
@ -2933,16 +2819,13 @@ partition by list(a)
partition test_select_list_partition_p2 values (1,2,3),
partition test_select_list_partition_p3 values (4,5,6)
);
insert into test_select_list_partition values(2);
--success
select * from test_select_list_partition partition (test_select_list_partition_p1) order by 1, 2;
a | b
---+---
(0 rows)
--success
select * from test_select_list_partition partition (test_select_list_partition_p2) order by 1, 2;
a | b
@ -2950,18 +2833,15 @@ select * from test_select_list_partition partition (test_select_list_partition_p
2 |
(1 row)
--success
select * from test_select_list_partition partition (test_select_list_partition_p3) order by 1, 2;
a | b
---+---
(0 rows)
--success
select * from test_select_list_partition partition (test_select_list_partition_p4) order by 1, 2;
ERROR: partition "test_select_list_partition_p4" of relation "test_select_list_partition" does not exist
--success
select a from test_select_list_partition partition (test_select_list_partition_p2) order by 1;
a
@ -2969,14 +2849,12 @@ select a from test_select_list_partition partition (test_select_list_partition_p
2
(1 row)
--success
select a from test_select_list_partition partition for (0) order by 1;
a
---
(0 rows)
--success
select a from test_select_list_partition partition for (1) order by 1;
a
@ -2984,7 +2862,6 @@ select a from test_select_list_partition partition for (1) order by 1;
2
(1 row)
--success
select a from test_select_list_partition partition for (2) order by 1;
a
@ -2992,29 +2869,24 @@ select a from test_select_list_partition partition for (2) order by 1;
2
(1 row)
--success
select a from test_select_list_partition partition for (5) order by 1;
a
---
(0 rows)
--success
select a from test_select_list_partition partition for (8) order by 1;
ERROR: Cannot find partition by the value
DETAIL: N/A.
-- fail: table is not partitioned table
select a from hw_partition_select_ordinary_table partition (test_select_list_partition_p2);
ERROR: relation "hw_partition_select_ordinary_table" is not partitioned table
DETAIL: N/A.
-- fail: table is not partitioned table
select a from hw_partition_select_ordinary_table partition for (2);
ERROR: relation "hw_partition_select_ordinary_table" is not partitioned table
DETAIL: N/A.
--
--
CREATE TABLE hw_partition_select_test(C_INT INTEGER)
@ -3027,14 +2899,12 @@ CREATE TABLE hw_partition_select_test(C_INT INTEGER)
insert into hw_partition_select_test values(111);
insert into hw_partition_select_test values(555);
insert into hw_partition_select_test values(888);
select a.* from hw_partition_select_test partition(hw_partition_select_test_part_1) a;
c_int
-------
111
(1 row)
create table list_partitioned_table (a int)
partition by list(a)
(
@ -3042,12 +2912,10 @@ partition by list(a)
partition list_partitioned_table_p2 values (1,2,3),
partition list_partitioned_table_p3 values (4,5,6)
);
insert into list_partitioned_table values (1);
insert into list_partitioned_table values (2);
insert into list_partitioned_table values (5);
insert into list_partitioned_table values (6);
with tmp1 as (select a from list_partitioned_table partition for (2)) select a from tmp1 order by 1;
a
---
@ -3055,7 +2923,6 @@ with tmp1 as (select a from list_partitioned_table partition for (2)) select a f
2
(2 rows)
--
---- select union select
--
@ -3070,8 +2937,6 @@ insert into UNION_TABLE_043_1 values('BCDEFGH','bcdefgh',222,2.222,'2000-02-02 0
insert into UNION_TABLE_043_1 values('CDEFGHI','cdefghi',333,3.333,'2000-03-03 03:03:03');
insert into UNION_TABLE_043_1 values('DEFGHIJ','defghij',444,4.444,'2000-04-04 04:04:04');
insert into UNION_TABLE_043_1 values('EFGHIJK','efghijk',555,5.555,'2000-05-05 05:05:05');
create table UNION_TABLE_043_2(C_CHAR CHAR(103500), C_VARCHAR VARCHAR(1035), C_INT INTEGER not null, C_DP double precision, C_TS_WITHOUT TIMESTAMP WITHOUT TIME ZONE)
partition by list (C_INT)
(
@ -3083,7 +2948,6 @@ insert into UNION_TABLE_043_2 values('BCDEFGH','bcdefgh',222,2.222,'2010-02-02 0
insert into UNION_TABLE_043_2 values('CDEFGHI','cdefghi',333,3.333,'2000-03-03 03:03:03');
insert into UNION_TABLE_043_2 values('DEFGHIJ','defghij',444,4.444,'2010-04-04 04:04:04');
insert into UNION_TABLE_043_2 values('EFGHIJK','efghijk',555,5.555,'2020-05-05 05:05:05');
select C_INT,C_DP,C_TS_WITHOUT from UNION_TABLE_043_1 union select C_INT,C_DP,C_TS_WITHOUT from UNION_TABLE_043_2 order by 1,2,3;
c_int | c_dp | c_ts_without
-------+-------+--------------------------
@ -3097,7 +2961,6 @@ select C_INT,C_DP,C_TS_WITHOUT from UNION_TABLE_043_1 union select C_INT,C_DP,C_
555 | 5.555 | Tue May 05 05:05:05 2020
(8 rows)
select C_INT,C_DP,C_TS_WITHOUT from UNION_TABLE_043_1 partition (UNION_TABLE_043_1_1) union select C_INT,C_DP,C_TS_WITHOUT from UNION_TABLE_043_2 partition (UNION_TABLE_043_2_1) order by 1,2,3;
c_int | c_dp | c_ts_without
-------+-------+--------------------------
@ -3107,10 +2970,8 @@ select C_INT,C_DP,C_TS_WITHOUT from UNION_TABLE_043_1 partition (UNION_TABLE_043
333 | 3.333 | Fri Mar 03 03:03:03 2000
(4 rows)
drop table UNION_TABLE_043_1;
drop table UNION_TABLE_043_2;
drop schema FVT_COMPRESS cascade;
NOTICE: drop cascades to 6 other objects
DETAIL: drop cascades to table hw_partition_select_parttable
@ -3119,8 +2980,3 @@ drop cascades to table hw_partition_select_ordinary_table
drop cascades to table test_select_list_partition
drop cascades to table hw_partition_select_test
drop cascades to table list_partitioned_table

View File

@ -3,7 +3,6 @@ DROP SCHEMA subpartition_update CASCADE;
ERROR: schema "subpartition_update" does not exist
CREATE SCHEMA subpartition_update;
SET CURRENT_SCHEMA TO subpartition_update;
--update
CREATE TABLE range_list
(
@ -25,14 +24,12 @@ PARTITION BY RANGE (month_code) SUBPARTITION BY LIST (dept_code)
SUBPARTITION p_201902_b values ('2')
)
)DISABLE ROW MOVEMENT;
insert into range_list values('201902', '1', '1', 1);
insert into range_list values('201902', '2', '1', 1);
insert into range_list values('201902', '1', '1', 1);
insert into range_list values('201903', '2', '1', 1);
insert into range_list values('201903', '1', '1', 1);
insert into range_list values('201903', '2', '1', 1);
select * from range_list order by 1, 2, 3, 4;
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -44,7 +41,6 @@ select * from range_list order by 1, 2, 3, 4;
201903 | 2 | 1 | 1
(6 rows)
--error
update range_list set month_code = '201903';
ERROR: fail to update partitioned table "range_list"
@ -53,7 +49,6 @@ DETAIL: disable row movement
update range_list set dept_code = '2';
ERROR: fail to update partitioned table "range_list"
DETAIL: disable row movement
update range_list set user_no = '2';
select * from range_list order by 1, 2, 3, 4;
month_code | dept_code | user_no | sales_amt
@ -66,10 +61,8 @@ select * from range_list order by 1, 2, 3, 4;
201903 | 2 | 2 | 1
(6 rows)
-- test for upsert and merge into, both should report error
insert into range_list values('201902', '1', '1', 1) ON DUPLICATE KEY UPDATE sales_amt=1;
CREATE TABLE temp_table
(
month_code VARCHAR2 ( 30 ) NOT NULL ,
@ -87,10 +80,8 @@ WHEN NOT MATCHED THEN
INSERT VALUES (t2.month_code, t2.dept_code, t2.user_no, t2.sales_amt) WHERE t2.sales_amt = 1;
ERROR: fail to update partitioned table "range_list"
DETAIL: disable row movement
drop table temp_table;
drop table range_list;
CREATE TABLE range_list
(
month_code VARCHAR2 ( 30 ) NOT NULL ,
@ -111,14 +102,12 @@ PARTITION BY RANGE (month_code) SUBPARTITION BY LIST (dept_code)
SUBPARTITION p_201902_b values ('2')
)
)ENABLE ROW MOVEMENT;
insert into range_list values('201902', '1', '1', 1);
insert into range_list values('201902', '2', '1', 1);
insert into range_list values('201902', '1', '1', 1);
insert into range_list values('201903', '2', '1', 1);
insert into range_list values('201903', '1', '1', 1);
insert into range_list values('201903', '2', '1', 1);
select * from range_list order by 1, 2, 3, 4;
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -130,7 +119,6 @@ select * from range_list order by 1, 2, 3, 4;
201903 | 2 | 1 | 1
(6 rows)
select * from range_list subpartition (p_201901_a) order by 1, 2, 3, 4;
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -158,7 +146,6 @@ select * from range_list subpartition (p_201901_b) order by 1, 2, 3, 4;
201902 | 2 | 1 | 1
(3 rows)
select * from range_list partition (p_201901) order by 1, 2, 3, 4;
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -192,9 +179,7 @@ select * from range_list partition (p_201902) order by 1, 2, 3, 4;
201903 | 2 | 1 | 1
(6 rows)
drop table range_list;
-- FOREIGN KEY
drop table tb_02;
ERROR: table "tb_02" does not exist
@ -206,7 +191,6 @@ CREATE TABLE tb_02
col_4 int
);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "tb_02_pkey" for table "tb_02"
drop table range_range_02 cascade;
ERROR: table "range_range_02" does not exist
CREATE TABLE range_range_02
@ -230,10 +214,8 @@ PARTITION BY RANGE (col_1) SUBPARTITION BY RANGE (col_2)
SUBPARTITION p_range_2_2 VALUES LESS THAN( MAXVALUE )
)
);
insert into tb_02 values(0,0,0,0);
insert into range_range_02 values(0,0,0,0);
update tb_02 set col_1=8 where col_2=0;
ERROR: update or delete on table "tb_02" violates foreign key constraint "range_range_02_col_1_fkey" on table "range_range_02"
DETAIL: Key (col_1)=(0) is still referenced from table "range_range_02".

View File

@ -1,5 +1,4 @@
-- FOR PL/pgSQL ARRAY of RECORD TYPE scenarios --
-- check compatibility --
show sql_compatibility; -- expect ORA --
sql_compatibility
@ -7,13 +6,11 @@ show sql_compatibility; -- expect ORA --
A
(1 row)
-- create new schema --
drop schema if exists plpgsql_assignlist;
NOTICE: schema "plpgsql_assignlist" does not exist, skipping
create schema plpgsql_assignlist;
set current_schema = plpgsql_assignlist;
-- initialize table and type--
create type o1 as (o1a int, o1b int);
create type o2 as (o2a o1, o2b int);
@ -21,11 +18,9 @@ create type o3 as (o3a o2, o3b int);
create type o4 as (o4a o3, o4b int);
create type o5 as (o5a o2[], o5b int);
create type o6 as (o6a o5, o6b int);
----------------------------------------------------
------------------ START OF TESTS ------------------
----------------------------------------------------
-- test assign list without array: nested record
create or replace function get_age RETURNS integer as $$
declare
@ -55,7 +50,6 @@ CONTEXT: referenced column: get_age
456
(1 row)
-- test assign list without array: nested composite type
create or replace function get_age RETURNS integer as $$
declare
@ -78,7 +72,6 @@ CONTEXT: referenced column: get_age
456
(1 row)
-- test assign list with array: array in first three word
create or replace function get_age RETURNS integer as $$
declare
@ -106,8 +99,6 @@ CONTEXT: referenced column: get_age
789
(1 row)
-- test assign list with array: array in first three word
create or replace function get_age RETURNS integer as $$
declare
@ -134,7 +125,6 @@ CONTEXT: referenced column: get_age
456
(1 row)
-- test assign list with array: array in first three word
create or replace function get_age RETURNS integer as $$
declare
@ -161,7 +151,6 @@ CONTEXT: referenced column: get_age
456
(1 row)
-- test assign list with array: with record nested
create or replace function get_age RETURNS integer as $$
declare
@ -191,7 +180,6 @@ CONTEXT: referenced column: get_age
999
(1 row)
-- test assign list with table: with record nested
create or replace function get_age RETURNS integer as $$
declare
@ -221,7 +209,6 @@ CONTEXT: referenced column: get_age
999
(1 row)
--test assign list with array: array not in first three word
create or replace function get_age RETURNS integer as $$
declare
@ -249,7 +236,6 @@ CONTEXT: referenced column: get_age
456
(1 row)
--test o1.col1.col2 ref
create type ct as (num int,info text);
create type ct1 as (num int,info ct);
@ -276,7 +262,6 @@ return re_int;
end;
end autonomous_pkg_a;
/
select autonomous_pkg_a.autonomous_f_public(10);
INFO: count_public.info.num: 1
CONTEXT: referenced column: autonomous_f_public
@ -291,7 +276,6 @@ drop package autonomous_pkg_a;
NOTICE: drop cascades to function plpgsql_assignlist.autonomous_f_public(integer)
drop type ct1;
drop type ct;
--------------------------------------------------
------------------ END OF TESTS ------------------
--------------------------------------------------
@ -302,6 +286,5 @@ drop type if exists o4;
drop type if exists o3;
drop type if exists o2;
drop type if exists o1;
-- clean up --
drop schema if exists plpgsql_assignlist cascade;

View File

@ -1,28 +1,23 @@
-- FOR PL/pgSQL VARRAY Assign Value to Attribute scenarios --
-- check compatibility --
-- create new schema --
drop schema if exists plpgsql_arrayassign;
NOTICE: schema "plpgsql_arrayassign" does not exist, skipping
create schema plpgsql_arrayassign;
set current_schema = plpgsql_arrayassign;
-- initialize table and type--
create type info as (name varchar2(50), age int, address varchar2(20), salary float(2));
create type customer as (id number(10), c_info info);
create table customers (id number(10), c_info info);
insert into customers (id, c_info) values (1, ('Vera' ,32, 'Paris', 22999.00));
insert into customers (id, c_info) values (2, ('Zera' ,25, 'London', 5999.00));
insert into customers (id, c_info) values (3, ('Alice' ,22, 'Bangkok', 9800.98));
insert into customers (id, c_info) values (4, ('Jim' ,26, 'Dubai', 18700.00));
insert into customers (id, c_info) values (5, ('Kevin' ,28, 'Singapore', 18999.00));
insert into customers (id, c_info) values (6, ('Gauss' ,42, 'Beijing', 32999.00));
----------------------------------------------------
------------------ START OF TESTS ------------------
----------------------------------------------------
-- test assign value by :=
create or replace function get_customers RETURNS customer[] as $$
declare
@ -44,7 +39,6 @@ select get_customers();
{"(1,\"(Vera,32,Paris,22999)\")","(3,\"(Alice,22,Bangkok,9800.98)\")","(4,\"(Jim,26,Dubai,18700)\")"}
(1 row)
-- test assign value by select into
create or replace function get_customers RETURNS customer[] as $$
declare
@ -66,7 +60,6 @@ select get_customers();
{"(1,\"(Vera,32,Paris,22999)\")","(3,\"(Alice,22,Bangkok,9800.98)\")","(4,\"(Jim,26,Dubai,18700)\")"}
(1 row)
-- test assign value by fetch into
create or replace function get_customers RETURNS customer[] as $$
declare
@ -94,7 +87,6 @@ select get_customers();
{"(1,\"(Vera,32,Paris,22999)\")","(1,\"(Vera,32,Paris,22999)\")","(2,\"(Zera,25,London,5999)\")"}
(1 row)
-- test assign value by EXECUTE IMMEDIATE into
create or replace function get_customers RETURNS customer[] as $$
declare
@ -124,7 +116,6 @@ select get_customers();
{"(1,\"(Vera,32,Paris,22999)\")","(3,\"(Alice,22,Bangkok,9800.98)\")","(4,\"(Jim,26,Dubai,18700)\")"}
(1 row)
-- test assign value in two-dimensional arrays
-- (only := support assign value in two-dimensional arrays)
create or replace function get_customers RETURNS customer[] as $$
@ -150,7 +141,6 @@ select get_customers();
{{"(5,\"(Kevin,28,Singapore,18999)\")","(6,\"(Gauss,42,Beijing,32999)\")"},{"(7,\"(Bob,24,Shanghai,28999)\")","(8,\"(Jack,56,Hongkong,8999)\")"}}
(1 row)
-- test assign value with loop, if, case
create or replace function get_customers RETURNS customer[] as $$
declare
@ -195,7 +185,6 @@ select get_customers();
{"(1,\"(Vera,32,Paris,22999)\")","(2,\"(Zera,25,London,5999)\")","(3,\"(Alice,22,Bangkok,9800.98)\")","(4,\"(Jim,26,Dubai,18700)\")","(5,\"(Kevin,28,Singapore,18999)\")","(6,\"(Gauss,42,Beijing,32999)\")","(1,\"(Vera,32,Paris,22999)\")","(9,\"(Bob,24,Shanghai,28999)\")"}
(1 row)
--ERROR: assign value to deep level attribute is not supported yet
create or replace function get_customers RETURNS customer[] as $$
declare
@ -209,7 +198,6 @@ $$ language plpgsql;
ERROR: assign value to deep level attribute is not supported in SELECT/FETCH INTO method at or near "."
LINE 6: select 'bob' into customer_list(1).c_info.name;
^
--ERROR: test incorrect attribute name with T_CWORD type
create or replace function get_customers RETURNS customer[] as $$
declare
@ -223,7 +211,6 @@ $$ language plpgsql;
ERROR: attribute "a" does not exist
DETAIL: attribute "a" does not exist in array variable "customer_list"
CONTEXT: compilation of PL/pgSQL function "get_customers" near line 6
--ERROR: test incorrect attribute name with T_CWORD type
create or replace function get_customers RETURNS customer[] as $$
declare
@ -237,7 +224,6 @@ $$ language plpgsql;
ERROR: attribute "a" does not exist
DETAIL: attribute "a" does not exist in array variable "customer_list"
CONTEXT: compilation of PL/pgSQL function "get_customers" near line 6
--ERROR: test incorrect attribute name with T_DATUM type
create or replace function get_customers RETURNS customer[] as $$
declare
@ -251,7 +237,6 @@ $$ language plpgsql;
ERROR: attribute "customer_list" does not exist
DETAIL: attribute "customer_list" does not exist in array variable "customer_list"
CONTEXT: compilation of PL/pgSQL function "get_customers" near line 6
--ERROR: test incorrect attribute name with T_DATUM type
create or replace function get_customers RETURNS customer[] as $$
declare
@ -265,7 +250,6 @@ $$ language plpgsql;
ERROR: attribute "customer_list" does not exist
DETAIL: attribute "customer_list" does not exist in array variable "customer_list"
CONTEXT: compilation of PL/pgSQL function "get_customers" near line 6
--ERROR: test incorrect attribute name with T_DATUM type
create or replace function get_customers RETURNS customer[] as $$
declare
@ -279,7 +263,6 @@ $$ language plpgsql;
ERROR: attribute "customer_list" does not exist
DETAIL: attribute "customer_list" does not exist in array variable "customer_list"
CONTEXT: compilation of PL/pgSQL function "get_customers" near line 6
--ERROR: test incorrect attribute name with type name
create or replace function get_customers RETURNS customer[] as $$
declare
@ -293,7 +276,6 @@ $$ language plpgsql;
ERROR: attribute "c_list" does not exist
DETAIL: attribute "c_list" does not exist in array variable "customer_list"
CONTEXT: compilation of PL/pgSQL function "get_customers" near line 6
--ERROR: test incorrect attribute name with T_WORD type
create or replace function get_customers RETURNS customer[] as $$
declare
@ -307,7 +289,6 @@ $$ language plpgsql;
ERROR: attribute "a" does not exist
DETAIL: attribute "a" does not exist in array variable "customer_list"
CONTEXT: compilation of PL/pgSQL function "get_customers" near line 6
--ERROR: test incorrect attribute name with keyword
create or replace function get_customers RETURNS customer[] as $$
declare
@ -321,7 +302,6 @@ $$ language plpgsql;
ERROR: attribute "if" does not exist
DETAIL: attribute "if" does not exist in array variable "customer_list"
CONTEXT: compilation of PL/pgSQL function "get_customers" near line 6
--ERROR: test incorrect attribute name with keyword
create or replace function get_customers RETURNS customer[] as $$
declare
@ -335,7 +315,6 @@ $$ language plpgsql;
ERROR: attribute "end" does not exist
DETAIL: attribute "end" does not exist in array variable "customer_list"
CONTEXT: compilation of PL/pgSQL function "get_customers" near line 6
--ERROR: test missing attribute name
create or replace function get_customers RETURNS customer[] as $$
declare
@ -349,7 +328,6 @@ $$ language plpgsql;
ERROR: missing or illegal attribute name at or near ";"
LINE 6: select 'bob' into customer_list(1). ;
^
--ERROR: test missing attribute name
create or replace function get_customers RETURNS customer[] as $$
declare
@ -363,7 +341,6 @@ $$ language plpgsql;
ERROR: missing or illegal attribute name at or near ":="
LINE 6: customer_list(1). := 'bob';
^
--ERROR: test illegal attribute name
create or replace function get_customers RETURNS customer[] as $$
declare
@ -377,7 +354,6 @@ $$ language plpgsql;
ERROR: syntax error at or near ".6"
LINE 6: customer_list(1).6a := 'bob';
^
--ERROR: test illegal attribute name
create or replace function get_customers RETURNS customer[] as $$
declare
@ -391,7 +367,6 @@ $$ language plpgsql;
ERROR: missing or illegal attribute name at or near "%#"
LINE 6: customer_list(1).%# := 'bob';
^
--ERROR: test incorrect array name : spelling error
create or replace function get_customers RETURNS customer[] as $$
declare
@ -404,7 +379,6 @@ end;
$$ language plpgsql;
ERROR: function "customer_lis" doesn't exist
CONTEXT: compilation of PL/pgSQL function "get_customers" near line 4
--ERROR: test incorrect array name : scalar variable
create or replace function get_customers RETURNS customer[] as $$
declare
@ -419,7 +393,6 @@ $$ language plpgsql;
call get_customers();
ERROR: subscripted object in assignment is not an array
CONTEXT: PL/pgSQL function get_customers() line 7 at assignment
--ERROR: test incorrect array name : array type name
create or replace function get_customers RETURNS customer[] as $$
declare
@ -434,7 +407,6 @@ $$ language plpgsql;
ERROR: syntax error at or near "c_list"
LINE 7: c_list(1).id := 3;
^
--ERROR: test incorrect array name : array element type is not composite
create or replace function get_customers RETURNS customer[] as $$
declare
@ -451,7 +423,6 @@ call get_customers();
ERROR: array element type is not composite in assignment
DETAIL: array variable "id" must be composite when assign value to attibute
CONTEXT: PL/pgSQL function get_customers() line 8 at assignment
--ERROR: test incorrect array name : array element type is record/row
create or replace function get_customers RETURNS customer[] as $$
declare
@ -466,7 +437,6 @@ $$ language plpgsql;
call get_customers();
ERROR: subscripted object in assignment is not an array
CONTEXT: PL/pgSQL function get_customers() line 7 at assignment
--ERROR: test array dimensions exceeds the maximum.
create or replace function get_customers RETURNS customer[] as $$
declare
@ -482,7 +452,6 @@ $$ language plpgsql;
call get_customers();
ERROR: number of array dimensions (7) exceeds the maximum allowed (6) in assignment.
CONTEXT: PL/pgSQL function get_customers() line 8 at assignment
-- Test PLPGSQL ARRAY defined with type from different schema
drop schema if exists test_pl_array_schema;
NOTICE: schema "test_pl_array_schema" does not exist, skipping
@ -503,7 +472,6 @@ create TYPE test_pl_array_schema.varchar2_table as (str VARCHAR2(2000));
create TYPE test_pl_array_schema.number_table as (num NUMBER);
create TYPE test_pl_array_schema.date_table as (dat DATE);
create TYPE test_pl_array_schema.comp_table as (a int, b VARCHAR2(10));
create or replace function get_table_array RETURNS void as $$
declare
type num_arr is VARRAY(10) of test_pl_array_schema.number_table;
@ -537,11 +505,9 @@ NOTICE: 1 aaa Sat Apr 12 04:05:06 2003 22 11 haha
(1 row)
--------------------------------------------------
------------------ END OF TESTS ------------------
--------------------------------------------------
drop function if exists get_table_array;
drop type if exists test_pl_array_schema.comp_table;
drop type if exists test_pl_array_schema.date_table;
@ -552,7 +518,6 @@ drop function if exists get_customers;
drop table if exists customers;
drop type if exists customer;
drop type if exists info;
-- clean up --
drop schema if exists test_pl_array_schema cascade;
drop schema if exists plpgsql_arrayassign cascade;