summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPallavi Sontakke2015-08-28 09:44:30 +0000
committerPallavi Sontakke2015-08-28 09:44:30 +0000
commitb1ce32739df95a898e881dc9cd9ab85ab211f5d5 (patch)
treebac13ad6ca3b297abd08ac43ecba508e5b1b25a7
parent8a7b7af30cbc659c54941521095ef429550f192b (diff)
Review comments incorporated. Highlighting insensitive cursor bug.
-rwxr-xr-x[-rw-r--r--]src/test/regress/expected/xl_limitations.out (renamed from src/test/regress/expected/xl_plpgsql.out)227
-rw-r--r--src/test/regress/expected/xl_user_defined_functions.out232
-rw-r--r--src/test/regress/serial_schedule3
-rwxr-xr-xsrc/test/regress/sql/xl_limitations.sql (renamed from src/test/regress/sql/xl_plpgsql.sql)91
-rwxr-xr-xsrc/test/regress/sql/xl_user_defined_functions.sql121
5 files changed, 415 insertions, 259 deletions
diff --git a/src/test/regress/expected/xl_plpgsql.out b/src/test/regress/expected/xl_limitations.out
index b2776aa544..ec0f545aec 100644..100755
--- a/src/test/regress/expected/xl_plpgsql.out
+++ b/src/test/regress/expected/xl_limitations.out
@@ -430,6 +430,7 @@ DELETE FROM xl_Pline WHERE CURRENT OF xl_scroll_cursor1;
ERROR: WHERE CURRENT OF clause not yet supported
COMMIT;
--insensitive cursor would be insensitive to updates happening to the table
+-- right now it is sensitive which is a bug (34) in Postgres-XL issue tracker sheet.
BEGIN;
declare xl_ins_cursor INSENSITIVE CURSOR for select * from xl_Pline order by slotname desc;
FETCH FIRST xl_ins_cursor;
@@ -449,7 +450,7 @@ insert into xl_PLine values ('PL.030', '-367', '', 'PS.first.tb6');
FETCH FIRST xl_ins_cursor;
slotname | phonenumber | comment | backlink
----------------------+----------------------+---------+----------------------
- PL.030 | -367 | | PS.first.tb6
+ PL.029 | -367 | | PS.first.tb6
(1 row)
select xl_nodename_from_id(xc_node_id), * from xl_Pline where slotname in ('PL.030', 'PL.029') order by slotname;
@@ -470,7 +471,7 @@ delete from xl_Pline where slotname in ('PL.029');
FETCH FIRST xl_ins_cursor;
slotname | phonenumber | comment | backlink
----------------------+----------------------+--------------+----------------------
- PL.028 | -501 | Fax entrance | PS.base.ta2
+ PL.029 | -367 | | PS.first.tb6
(1 row)
insert into xl_PLine values ('PL.029', '-367', '', 'PS.first.tb6');
@@ -570,188 +571,6 @@ ERROR: current transaction is aborted, commands ignored until end of transactio
rollback to x;
ERROR: no such savepoint
commit; -- still fails
---User defined functions have several limitations
---Basic insert, update, delete test on multiple datanodes using plpgsql function is passing.
-create function xl_insert_Pline_test(int) returns boolean as $$
-BEGIN
- IF $1 < 20 THEN
- insert into xl_PLine values ('PL.030', '-367', '', 'PS.first.tb6');
- insert into xl_PLine values ('PL.031', '-367', '', 'PS.first.tb6');
- insert into xl_PLine values ('PL.032', '-367', '', 'PS.first.tb6');
- insert into xl_PLine values ('PL.033', '-367', '', 'PS.first.tb6');
- insert into xl_PLine values ('PL.034', '-367', '', 'PS.first.tb6');
- insert into xl_PLine values ('PL.035', '-367', '', 'PS.first.tb6');
- insert into xl_PLine values ('PL.036', '-367', '', 'PS.first.tb6');
- RETURN TRUE;
- ELSE
- RETURN FALSE;
- END IF;
-END;$$ language plpgsql;
-select xl_insert_Pline_test(1);
- xl_insert_pline_test
-----------------------
- t
-(1 row)
-
-select xl_nodename_from_id(xc_node_id), * from xl_Pline order by slotname;
- xl_nodename_from_id | slotname | phonenumber | comment | backlink
----------------------+----------------------+----------------------+-----------------+----------------------
- datanode_1 | PL.001 | -0 | Central call | PS.base.ta1
- datanode_2 | PL.002 | -101 | | PS.base.ta2
- datanode_2 | PL.003 | -102 | | PS.base.ta3
- datanode_1 | PL.004 | -103 | | PS.base.ta5
- datanode_1 | PL.005 | -104 | | PS.base.ta6
- datanode_2 | PL.006 | -106 | | PS.base.tb2
- datanode_2 | PL.007 | -108 | | PS.base.tb3
- datanode_2 | PL.008 | -109 | | PS.base.tb4
- datanode_2 | PL.009 | -121 | | PS.base.tb5
- datanode_2 | PL.010 | -122 | | PS.base.tb6
- datanode_1 | PL.011 | -122 | | PS.base.tb6
- datanode_2 | PL.012 | -122 | | PS.base.tb6
- datanode_1 | PL.013 | -122 | | PS.base.tb6
- datanode_2 | PL.014 | -122 | | PS.base.tb6
- datanode_2 | PL.015 | -134 | | PS.first.ta1
- datanode_2 | PL.016 | -137 | | PS.first.ta3
- datanode_2 | PL.017 | -139 | | PS.first.ta4
- datanode_1 | PL.018 | -362 | | PS.first.tb1
- datanode_2 | PL.019 | -363 | | PS.first.tb2
- datanode_1 | PL.020 | -364 | | PS.first.tb3
- datanode_1 | PL.021 | -365 | | PS.first.tb5
- datanode_2 | PL.022 | -367 | | PS.first.tb6
- datanode_2 | PL.023 | -367 | | PS.first.tb6
- datanode_2 | PL.024 | -367 | | PS.first.tb6
- datanode_2 | PL.025 | -367 | | PS.first.tb6
- datanode_2 | PL.026 | -367 | | PS.first.tb6
- datanode_1 | PL.027 | -367 | | PS.first.tb6
- datanode_1 | PL.028 | -501 | Fax entrance | PS.base.ta2
- datanode_1 | PL.029 | -502 | Fax first floor | PS.first.ta1
- datanode_1 | PL.030 | -367 | | PS.first.tb6
- datanode_1 | PL.031 | -367 | | PS.first.tb6
- datanode_1 | PL.032 | -367 | | PS.first.tb6
- datanode_2 | PL.033 | -367 | | PS.first.tb6
- datanode_2 | PL.034 | -367 | | PS.first.tb6
- datanode_1 | PL.035 | -367 | | PS.first.tb6
- datanode_1 | PL.036 | -367 | | PS.first.tb6
-(36 rows)
-
-create function xl_update_Pline_test(int) returns boolean as $$
-BEGIN
- IF $1 < 20 THEN
- update xl_Pline set phonenumber = '400' where slotname = 'PL.030';
- update xl_Pline set phonenumber = '400' where slotname = 'PL.031';
- update xl_Pline set phonenumber = '400' where slotname = 'PL.032';
- update xl_Pline set phonenumber = '400' where slotname = 'PL.033';
- update xl_Pline set phonenumber = '400' where slotname = 'PL.034';
- update xl_Pline set phonenumber = '400' where slotname = 'PL.035';
- update xl_Pline set phonenumber = '400' where slotname = 'PL.036';
- RETURN TRUE;
- ELSE
- RETURN FALSE;
- END IF;
-END;$$ language plpgsql;
-select xl_update_Pline_test(1);
- xl_update_pline_test
-----------------------
- t
-(1 row)
-
-select xl_nodename_from_id(xc_node_id), * from xl_Pline order by slotname;
- xl_nodename_from_id | slotname | phonenumber | comment | backlink
----------------------+----------------------+----------------------+-----------------+----------------------
- datanode_1 | PL.001 | -0 | Central call | PS.base.ta1
- datanode_2 | PL.002 | -101 | | PS.base.ta2
- datanode_2 | PL.003 | -102 | | PS.base.ta3
- datanode_1 | PL.004 | -103 | | PS.base.ta5
- datanode_1 | PL.005 | -104 | | PS.base.ta6
- datanode_2 | PL.006 | -106 | | PS.base.tb2
- datanode_2 | PL.007 | -108 | | PS.base.tb3
- datanode_2 | PL.008 | -109 | | PS.base.tb4
- datanode_2 | PL.009 | -121 | | PS.base.tb5
- datanode_2 | PL.010 | -122 | | PS.base.tb6
- datanode_1 | PL.011 | -122 | | PS.base.tb6
- datanode_2 | PL.012 | -122 | | PS.base.tb6
- datanode_1 | PL.013 | -122 | | PS.base.tb6
- datanode_2 | PL.014 | -122 | | PS.base.tb6
- datanode_2 | PL.015 | -134 | | PS.first.ta1
- datanode_2 | PL.016 | -137 | | PS.first.ta3
- datanode_2 | PL.017 | -139 | | PS.first.ta4
- datanode_1 | PL.018 | -362 | | PS.first.tb1
- datanode_2 | PL.019 | -363 | | PS.first.tb2
- datanode_1 | PL.020 | -364 | | PS.first.tb3
- datanode_1 | PL.021 | -365 | | PS.first.tb5
- datanode_2 | PL.022 | -367 | | PS.first.tb6
- datanode_2 | PL.023 | -367 | | PS.first.tb6
- datanode_2 | PL.024 | -367 | | PS.first.tb6
- datanode_2 | PL.025 | -367 | | PS.first.tb6
- datanode_2 | PL.026 | -367 | | PS.first.tb6
- datanode_1 | PL.027 | -367 | | PS.first.tb6
- datanode_1 | PL.028 | -501 | Fax entrance | PS.base.ta2
- datanode_1 | PL.029 | -502 | Fax first floor | PS.first.ta1
- datanode_1 | PL.030 | 400 | | PS.first.tb6
- datanode_1 | PL.031 | 400 | | PS.first.tb6
- datanode_1 | PL.032 | 400 | | PS.first.tb6
- datanode_2 | PL.033 | 400 | | PS.first.tb6
- datanode_2 | PL.034 | 400 | | PS.first.tb6
- datanode_1 | PL.035 | 400 | | PS.first.tb6
- datanode_1 | PL.036 | 400 | | PS.first.tb6
-(36 rows)
-
-create function xl_delete_Pline_test(int) returns boolean as $$
-BEGIN
- IF $1 < 20 THEN
- delete from xl_Pline where slotname = 'PL.030';
- delete from xl_Pline where slotname = 'PL.031';
- delete from xl_Pline where slotname = 'PL.032';
- delete from xl_Pline where slotname = 'PL.033';
- delete from xl_Pline where slotname = 'PL.034';
- delete from xl_Pline where slotname = 'PL.035';
- delete from xl_Pline where slotname = 'PL.036';
-
- RETURN TRUE;
- ELSE
- RETURN FALSE;
- END IF;
-END;$$ language plpgsql;
-select xl_delete_Pline_test(1);
- xl_delete_pline_test
-----------------------
- t
-(1 row)
-
-select xl_nodename_from_id(xc_node_id), * from xl_Pline order by slotname;
- xl_nodename_from_id | slotname | phonenumber | comment | backlink
----------------------+----------------------+----------------------+-----------------+----------------------
- datanode_1 | PL.001 | -0 | Central call | PS.base.ta1
- datanode_2 | PL.002 | -101 | | PS.base.ta2
- datanode_2 | PL.003 | -102 | | PS.base.ta3
- datanode_1 | PL.004 | -103 | | PS.base.ta5
- datanode_1 | PL.005 | -104 | | PS.base.ta6
- datanode_2 | PL.006 | -106 | | PS.base.tb2
- datanode_2 | PL.007 | -108 | | PS.base.tb3
- datanode_2 | PL.008 | -109 | | PS.base.tb4
- datanode_2 | PL.009 | -121 | | PS.base.tb5
- datanode_2 | PL.010 | -122 | | PS.base.tb6
- datanode_1 | PL.011 | -122 | | PS.base.tb6
- datanode_2 | PL.012 | -122 | | PS.base.tb6
- datanode_1 | PL.013 | -122 | | PS.base.tb6
- datanode_2 | PL.014 | -122 | | PS.base.tb6
- datanode_2 | PL.015 | -134 | | PS.first.ta1
- datanode_2 | PL.016 | -137 | | PS.first.ta3
- datanode_2 | PL.017 | -139 | | PS.first.ta4
- datanode_1 | PL.018 | -362 | | PS.first.tb1
- datanode_2 | PL.019 | -363 | | PS.first.tb2
- datanode_1 | PL.020 | -364 | | PS.first.tb3
- datanode_1 | PL.021 | -365 | | PS.first.tb5
- datanode_2 | PL.022 | -367 | | PS.first.tb6
- datanode_2 | PL.023 | -367 | | PS.first.tb6
- datanode_2 | PL.024 | -367 | | PS.first.tb6
- datanode_2 | PL.025 | -367 | | PS.first.tb6
- datanode_2 | PL.026 | -367 | | PS.first.tb6
- datanode_1 | PL.027 | -367 | | PS.first.tb6
- datanode_1 | PL.028 | -501 | Fax entrance | PS.base.ta2
- datanode_1 | PL.029 | -502 | Fax first floor | PS.first.ta1
-(29 rows)
-
--Correlated UPDATE/DELETE is not supported.
-- distributed by default ==> xl_t by HASH(no), xl_t1 by HASH(no1)
CREATE TABLE xl_t("no" integer,"name" character varying);
@@ -997,7 +816,6 @@ ERROR: Postgres-XL does not support FOREIGN DATA WRAPPER yet
DETAIL: The feature is not currently supported
--LISTEN/NOTIFY is not supported. Looks like they are supported now.
--We would obviously have issues with LISTEN/NOTIFY if clients are connected to different coordinators. Need to test that manually as it is difficult via regression.
---Should work. Send a valid message via a valid channel name
--LISTEN notify_async1;
-- commenting LISTEN as PIDs shown here would never match in regression.
SELECT pg_notify('notify_async1','sample message1');
@@ -1042,7 +860,40 @@ SELECT pg_notify('fo' || 'o', 'pay' || 'load');
drop function xl_room_au();
drop function xl_trap_zero_divide(int);
+--GROUPING SETs are not supported
+--xl_items_sold gets distributed by default on HASH(brand)
+-- below test looks to be working fine for data spanning multiple nodes.
+-- However existing groupingsets.sql test is failing for Postgres-XL (Low priority)
+create table xl_items_sold (
+ brand char(20),
+ size_sold char(2),
+ sales integer
+);
+insert into xl_items_sold values ('Foo', 'L','10');
+insert into xl_items_sold values ('Foo', 'M','20');
+insert into xl_items_sold values ('Bar', 'M','15');
+insert into xl_items_sold values ('Bar', 'L','5');
+select xl_nodename_from_id(xc_node_id), * from xl_items_sold;
+ xl_nodename_from_id | brand | size_sold | sales
+---------------------+----------------------+-----------+-------
+ datanode_1 | Foo | L | 10
+ datanode_1 | Foo | M | 20
+ datanode_2 | Bar | M | 15
+ datanode_2 | Bar | L | 5
+(4 rows)
+
+SELECT brand, size_sold, sum(sales) FROM xl_items_sold GROUP BY GROUPING SETS ((brand), (size_sold), ());
+ brand | size_sold | sum
+----------------------+-----------+-----
+ Foo | | 30
+ | | 30
+ | L | 10
+ | M | 20
+ Bar | | 20
+ | | 20
+ | L | 5
+ | M | 15
+(8 rows)
+
+drop table xl_items_sold;
drop function xl_nodename_from_id(integer);
-drop function xl_insert_Pline_test(int);
-drop function xl_update_Pline_test(int);
-drop function xl_delete_Pline_test(int);
diff --git a/src/test/regress/expected/xl_user_defined_functions.out b/src/test/regress/expected/xl_user_defined_functions.out
new file mode 100644
index 0000000000..5852116593
--- /dev/null
+++ b/src/test/regress/expected/xl_user_defined_functions.out
@@ -0,0 +1,232 @@
+--User defined functions have several limitations
+--Basic insert, update, delete test on multiple datanodes using plpgsql function is passing.
+--default distributed by HASH(slotname)
+create function xl_nodename_from_id1(integer) returns name as $$
+declare
+ n name;
+BEGIN
+ select node_name into n from pgxc_node where node_id = $1;
+ RETURN n;
+END;$$ language plpgsql;
+create table xl_Pline1 (
+ slotname char(20),
+ phonenumber char(20),
+ comment text,
+ backlink char(20)
+);
+create unique index xl_Pline1_name on xl_Pline1 using btree (slotname bpchar_ops);
+--insert Plines
+insert into xl_Pline1 values ('PL.001', '-0', 'Central call', 'PS.base.ta1');
+insert into xl_Pline1 values ('PL.002', '-101', '', 'PS.base.ta2');
+insert into xl_Pline1 values ('PL.003', '-102', '', 'PS.base.ta3');
+insert into xl_Pline1 values ('PL.004', '-103', '', 'PS.base.ta5');
+insert into xl_Pline1 values ('PL.005', '-104', '', 'PS.base.ta6');
+insert into xl_Pline1 values ('PL.006', '-106', '', 'PS.base.tb2');
+insert into xl_Pline1 values ('PL.007', '-108', '', 'PS.base.tb3');
+insert into xl_Pline1 values ('PL.008', '-109', '', 'PS.base.tb4');
+insert into xl_Pline1 values ('PL.009', '-121', '', 'PS.base.tb5');
+insert into xl_Pline1 values ('PL.010', '-122', '', 'PS.base.tb6');
+insert into xl_Pline1 values ('PL.011', '-122', '', 'PS.base.tb6');
+insert into xl_Pline1 values ('PL.012', '-122', '', 'PS.base.tb6');
+insert into xl_Pline1 values ('PL.013', '-122', '', 'PS.base.tb6');
+insert into xl_Pline1 values ('PL.014', '-122', '', 'PS.base.tb6');
+insert into xl_Pline1 values ('PL.015', '-134', '', 'PS.first.ta1');
+insert into xl_Pline1 values ('PL.016', '-137', '', 'PS.first.ta3');
+insert into xl_Pline1 values ('PL.017', '-139', '', 'PS.first.ta4');
+insert into xl_Pline1 values ('PL.018', '-362', '', 'PS.first.tb1');
+insert into xl_Pline1 values ('PL.019', '-363', '', 'PS.first.tb2');
+insert into xl_Pline1 values ('PL.020', '-364', '', 'PS.first.tb3');
+insert into xl_Pline1 values ('PL.021', '-365', '', 'PS.first.tb5');
+insert into xl_Pline1 values ('PL.022', '-367', '', 'PS.first.tb6');
+insert into xl_Pline1 values ('PL.023', '-367', '', 'PS.first.tb6');
+insert into xl_Pline1 values ('PL.024', '-367', '', 'PS.first.tb6');
+insert into xl_Pline1 values ('PL.025', '-367', '', 'PS.first.tb6');
+insert into xl_Pline1 values ('PL.026', '-367', '', 'PS.first.tb6');
+insert into xl_Pline1 values ('PL.027', '-367', '', 'PS.first.tb6');
+insert into xl_Pline1 values ('PL.028', '-501', 'Fax entrance', 'PS.base.ta2');
+insert into xl_Pline1 values ('PL.029', '-502', 'Fax first floor', 'PS.first.ta1');
+create function xl_insert_Pline_test(int) returns boolean as $$
+BEGIN
+ IF $1 < 20 THEN
+ insert into xl_Pline1 values ('PL.030', '-367', '', 'PS.first.tb6');
+ insert into xl_Pline1 values ('PL.031', '-367', '', 'PS.first.tb6');
+ insert into xl_Pline1 values ('PL.032', '-367', '', 'PS.first.tb6');
+ insert into xl_Pline1 values ('PL.033', '-367', '', 'PS.first.tb6');
+ insert into xl_Pline1 values ('PL.034', '-367', '', 'PS.first.tb6');
+ insert into xl_Pline1 values ('PL.035', '-367', '', 'PS.first.tb6');
+ insert into xl_Pline1 values ('PL.036', '-367', '', 'PS.first.tb6');
+ RETURN TRUE;
+ ELSE
+ RETURN FALSE;
+ END IF;
+END;$$ language plpgsql;
+select xl_insert_Pline_test(1);
+ xl_insert_pline_test
+----------------------
+ t
+(1 row)
+
+select xl_nodename_from_id1(xc_node_id), * from xl_Pline1 order by slotname;
+ xl_nodename_from_id1 | slotname | phonenumber | comment | backlink
+----------------------+----------------------+----------------------+-----------------+----------------------
+ datanode_1 | PL.001 | -0 | Central call | PS.base.ta1
+ datanode_2 | PL.002 | -101 | | PS.base.ta2
+ datanode_2 | PL.003 | -102 | | PS.base.ta3
+ datanode_1 | PL.004 | -103 | | PS.base.ta5
+ datanode_1 | PL.005 | -104 | | PS.base.ta6
+ datanode_2 | PL.006 | -106 | | PS.base.tb2
+ datanode_2 | PL.007 | -108 | | PS.base.tb3
+ datanode_2 | PL.008 | -109 | | PS.base.tb4
+ datanode_2 | PL.009 | -121 | | PS.base.tb5
+ datanode_2 | PL.010 | -122 | | PS.base.tb6
+ datanode_1 | PL.011 | -122 | | PS.base.tb6
+ datanode_2 | PL.012 | -122 | | PS.base.tb6
+ datanode_1 | PL.013 | -122 | | PS.base.tb6
+ datanode_2 | PL.014 | -122 | | PS.base.tb6
+ datanode_2 | PL.015 | -134 | | PS.first.ta1
+ datanode_2 | PL.016 | -137 | | PS.first.ta3
+ datanode_2 | PL.017 | -139 | | PS.first.ta4
+ datanode_1 | PL.018 | -362 | | PS.first.tb1
+ datanode_2 | PL.019 | -363 | | PS.first.tb2
+ datanode_1 | PL.020 | -364 | | PS.first.tb3
+ datanode_1 | PL.021 | -365 | | PS.first.tb5
+ datanode_2 | PL.022 | -367 | | PS.first.tb6
+ datanode_2 | PL.023 | -367 | | PS.first.tb6
+ datanode_2 | PL.024 | -367 | | PS.first.tb6
+ datanode_2 | PL.025 | -367 | | PS.first.tb6
+ datanode_2 | PL.026 | -367 | | PS.first.tb6
+ datanode_1 | PL.027 | -367 | | PS.first.tb6
+ datanode_1 | PL.028 | -501 | Fax entrance | PS.base.ta2
+ datanode_1 | PL.029 | -502 | Fax first floor | PS.first.ta1
+ datanode_1 | PL.030 | -367 | | PS.first.tb6
+ datanode_1 | PL.031 | -367 | | PS.first.tb6
+ datanode_1 | PL.032 | -367 | | PS.first.tb6
+ datanode_2 | PL.033 | -367 | | PS.first.tb6
+ datanode_2 | PL.034 | -367 | | PS.first.tb6
+ datanode_1 | PL.035 | -367 | | PS.first.tb6
+ datanode_1 | PL.036 | -367 | | PS.first.tb6
+(36 rows)
+
+create function xl_update_Pline_test(int) returns boolean as $$
+BEGIN
+ IF $1 < 20 THEN
+ update xl_Pline1 set phonenumber = '400' where slotname = 'PL.030';
+ update xl_Pline1 set phonenumber = '400' where slotname = 'PL.031';
+ update xl_Pline1 set phonenumber = '400' where slotname = 'PL.032';
+ update xl_Pline1 set phonenumber = '400' where slotname = 'PL.033';
+ update xl_Pline1 set phonenumber = '400' where slotname = 'PL.034';
+ update xl_Pline1 set phonenumber = '400' where slotname = 'PL.035';
+ update xl_Pline1 set phonenumber = '400' where slotname = 'PL.036';
+ RETURN TRUE;
+ ELSE
+ RETURN FALSE;
+ END IF;
+END;$$ language plpgsql;
+select xl_update_Pline_test(1);
+ xl_update_pline_test
+----------------------
+ t
+(1 row)
+
+select xl_nodename_from_id1(xc_node_id), * from xl_Pline1 order by slotname;
+ xl_nodename_from_id1 | slotname | phonenumber | comment | backlink
+----------------------+----------------------+----------------------+-----------------+----------------------
+ datanode_1 | PL.001 | -0 | Central call | PS.base.ta1
+ datanode_2 | PL.002 | -101 | | PS.base.ta2
+ datanode_2 | PL.003 | -102 | | PS.base.ta3
+ datanode_1 | PL.004 | -103 | | PS.base.ta5
+ datanode_1 | PL.005 | -104 | | PS.base.ta6
+ datanode_2 | PL.006 | -106 | | PS.base.tb2
+ datanode_2 | PL.007 | -108 | | PS.base.tb3
+ datanode_2 | PL.008 | -109 | | PS.base.tb4
+ datanode_2 | PL.009 | -121 | | PS.base.tb5
+ datanode_2 | PL.010 | -122 | | PS.base.tb6
+ datanode_1 | PL.011 | -122 | | PS.base.tb6
+ datanode_2 | PL.012 | -122 | | PS.base.tb6
+ datanode_1 | PL.013 | -122 | | PS.base.tb6
+ datanode_2 | PL.014 | -122 | | PS.base.tb6
+ datanode_2 | PL.015 | -134 | | PS.first.ta1
+ datanode_2 | PL.016 | -137 | | PS.first.ta3
+ datanode_2 | PL.017 | -139 | | PS.first.ta4
+ datanode_1 | PL.018 | -362 | | PS.first.tb1
+ datanode_2 | PL.019 | -363 | | PS.first.tb2
+ datanode_1 | PL.020 | -364 | | PS.first.tb3
+ datanode_1 | PL.021 | -365 | | PS.first.tb5
+ datanode_2 | PL.022 | -367 | | PS.first.tb6
+ datanode_2 | PL.023 | -367 | | PS.first.tb6
+ datanode_2 | PL.024 | -367 | | PS.first.tb6
+ datanode_2 | PL.025 | -367 | | PS.first.tb6
+ datanode_2 | PL.026 | -367 | | PS.first.tb6
+ datanode_1 | PL.027 | -367 | | PS.first.tb6
+ datanode_1 | PL.028 | -501 | Fax entrance | PS.base.ta2
+ datanode_1 | PL.029 | -502 | Fax first floor | PS.first.ta1
+ datanode_1 | PL.030 | 400 | | PS.first.tb6
+ datanode_1 | PL.031 | 400 | | PS.first.tb6
+ datanode_1 | PL.032 | 400 | | PS.first.tb6
+ datanode_2 | PL.033 | 400 | | PS.first.tb6
+ datanode_2 | PL.034 | 400 | | PS.first.tb6
+ datanode_1 | PL.035 | 400 | | PS.first.tb6
+ datanode_1 | PL.036 | 400 | | PS.first.tb6
+(36 rows)
+
+create function xl_delete_Pline_test(int) returns boolean as $$
+BEGIN
+ IF $1 < 20 THEN
+ delete from xl_Pline1 where slotname = 'PL.030';
+ delete from xl_Pline1 where slotname = 'PL.031';
+ delete from xl_Pline1 where slotname = 'PL.032';
+ delete from xl_Pline1 where slotname = 'PL.033';
+ delete from xl_Pline1 where slotname = 'PL.034';
+ delete from xl_Pline1 where slotname = 'PL.035';
+ delete from xl_Pline1 where slotname = 'PL.036';
+
+ RETURN TRUE;
+ ELSE
+ RETURN FALSE;
+ END IF;
+END;$$ language plpgsql;
+select xl_delete_Pline_test(1);
+ xl_delete_pline_test
+----------------------
+ t
+(1 row)
+
+select xl_nodename_from_id1(xc_node_id), * from xl_Pline1 order by slotname;
+ xl_nodename_from_id1 | slotname | phonenumber | comment | backlink
+----------------------+----------------------+----------------------+-----------------+----------------------
+ datanode_1 | PL.001 | -0 | Central call | PS.base.ta1
+ datanode_2 | PL.002 | -101 | | PS.base.ta2
+ datanode_2 | PL.003 | -102 | | PS.base.ta3
+ datanode_1 | PL.004 | -103 | | PS.base.ta5
+ datanode_1 | PL.005 | -104 | | PS.base.ta6
+ datanode_2 | PL.006 | -106 | | PS.base.tb2
+ datanode_2 | PL.007 | -108 | | PS.base.tb3
+ datanode_2 | PL.008 | -109 | | PS.base.tb4
+ datanode_2 | PL.009 | -121 | | PS.base.tb5
+ datanode_2 | PL.010 | -122 | | PS.base.tb6
+ datanode_1 | PL.011 | -122 | | PS.base.tb6
+ datanode_2 | PL.012 | -122 | | PS.base.tb6
+ datanode_1 | PL.013 | -122 | | PS.base.tb6
+ datanode_2 | PL.014 | -122 | | PS.base.tb6
+ datanode_2 | PL.015 | -134 | | PS.first.ta1
+ datanode_2 | PL.016 | -137 | | PS.first.ta3
+ datanode_2 | PL.017 | -139 | | PS.first.ta4
+ datanode_1 | PL.018 | -362 | | PS.first.tb1
+ datanode_2 | PL.019 | -363 | | PS.first.tb2
+ datanode_1 | PL.020 | -364 | | PS.first.tb3
+ datanode_1 | PL.021 | -365 | | PS.first.tb5
+ datanode_2 | PL.022 | -367 | | PS.first.tb6
+ datanode_2 | PL.023 | -367 | | PS.first.tb6
+ datanode_2 | PL.024 | -367 | | PS.first.tb6
+ datanode_2 | PL.025 | -367 | | PS.first.tb6
+ datanode_2 | PL.026 | -367 | | PS.first.tb6
+ datanode_1 | PL.027 | -367 | | PS.first.tb6
+ datanode_1 | PL.028 | -501 | Fax entrance | PS.base.ta2
+ datanode_1 | PL.029 | -502 | Fax first floor | PS.first.ta1
+(29 rows)
+
+drop table xl_Pline1;
+drop function xl_nodename_from_id1(integer);
+drop function xl_insert_Pline_test(int);
+drop function xl_update_Pline_test(int);
+drop function xl_delete_Pline_test(int);
diff --git a/src/test/regress/serial_schedule b/src/test/regress/serial_schedule
index 949d5dbeeb..12dd2d5f77 100644
--- a/src/test/regress/serial_schedule
+++ b/src/test/regress/serial_schedule
@@ -183,4 +183,5 @@ test: xl_alter_table
test: xl_distribution_column_types_modulo
test: xl_plan_pushdown
test: xl_functions
-test: xl_plpgsql
+test: xl_limitations
+test: xl_user_defined_functions
diff --git a/src/test/regress/sql/xl_plpgsql.sql b/src/test/regress/sql/xl_limitations.sql
index 352354ea83..450110427b 100755
--- a/src/test/regress/sql/xl_plpgsql.sql
+++ b/src/test/regress/sql/xl_limitations.sql
@@ -224,6 +224,7 @@ DELETE FROM xl_Pline WHERE CURRENT OF xl_scroll_cursor1;
COMMIT;
--insensitive cursor would be insensitive to updates happening to the table
+-- right now it is sensitive which is a bug (34) in Postgres-XL issue tracker sheet.
BEGIN;
declare xl_ins_cursor INSENSITIVE CURSOR for select * from xl_Pline order by slotname desc;
@@ -261,71 +262,6 @@ begin;
rollback to x;
commit; -- still fails
---User defined functions have several limitations
---Basic insert, update, delete test on multiple datanodes using plpgsql function is passing.
-create function xl_insert_Pline_test(int) returns boolean as $$
-BEGIN
- IF $1 < 20 THEN
- insert into xl_PLine values ('PL.030', '-367', '', 'PS.first.tb6');
- insert into xl_PLine values ('PL.031', '-367', '', 'PS.first.tb6');
- insert into xl_PLine values ('PL.032', '-367', '', 'PS.first.tb6');
- insert into xl_PLine values ('PL.033', '-367', '', 'PS.first.tb6');
- insert into xl_PLine values ('PL.034', '-367', '', 'PS.first.tb6');
- insert into xl_PLine values ('PL.035', '-367', '', 'PS.first.tb6');
- insert into xl_PLine values ('PL.036', '-367', '', 'PS.first.tb6');
- RETURN TRUE;
- ELSE
- RETURN FALSE;
- END IF;
-END;$$ language plpgsql;
-
-select xl_insert_Pline_test(1);
-
-select xl_nodename_from_id(xc_node_id), * from xl_Pline order by slotname;
-
-
-create function xl_update_Pline_test(int) returns boolean as $$
-BEGIN
- IF $1 < 20 THEN
- update xl_Pline set phonenumber = '400' where slotname = 'PL.030';
- update xl_Pline set phonenumber = '400' where slotname = 'PL.031';
- update xl_Pline set phonenumber = '400' where slotname = 'PL.032';
- update xl_Pline set phonenumber = '400' where slotname = 'PL.033';
- update xl_Pline set phonenumber = '400' where slotname = 'PL.034';
- update xl_Pline set phonenumber = '400' where slotname = 'PL.035';
- update xl_Pline set phonenumber = '400' where slotname = 'PL.036';
- RETURN TRUE;
- ELSE
- RETURN FALSE;
- END IF;
-END;$$ language plpgsql;
-
-select xl_update_Pline_test(1);
-
-select xl_nodename_from_id(xc_node_id), * from xl_Pline order by slotname;
-
-create function xl_delete_Pline_test(int) returns boolean as $$
-BEGIN
- IF $1 < 20 THEN
- delete from xl_Pline where slotname = 'PL.030';
- delete from xl_Pline where slotname = 'PL.031';
- delete from xl_Pline where slotname = 'PL.032';
- delete from xl_Pline where slotname = 'PL.033';
- delete from xl_Pline where slotname = 'PL.034';
- delete from xl_Pline where slotname = 'PL.035';
- delete from xl_Pline where slotname = 'PL.036';
-
- RETURN TRUE;
- ELSE
- RETURN FALSE;
- END IF;
-END;$$ language plpgsql;
-
-select xl_delete_Pline_test(1);
-
-select xl_nodename_from_id(xc_node_id), * from xl_Pline order by slotname;
-
-
--Correlated UPDATE/DELETE is not supported.
-- distributed by default ==> xl_t by HASH(no), xl_t1 by HASH(no1)
CREATE TABLE xl_t("no" integer,"name" character varying);
@@ -506,7 +442,6 @@ CREATE FOREIGN DATA WRAPPER xl_foo VALIDATOR postgresql_fdw_validator;
--LISTEN/NOTIFY is not supported. Looks like they are supported now.
--We would obviously have issues with LISTEN/NOTIFY if clients are connected to different coordinators. Need to test that manually as it is difficult via regression.
---Should work. Send a valid message via a valid channel name
--LISTEN notify_async1;
-- commenting LISTEN as PIDs shown here would never match in regression.
SELECT pg_notify('notify_async1','sample message1');
@@ -535,11 +470,27 @@ SELECT pg_notify('fo' || 'o', 'pay' || 'load');
drop function xl_room_au();
drop function xl_trap_zero_divide(int);
-drop function xl_nodename_from_id(integer);
-drop function xl_insert_Pline_test(int);
-drop function xl_update_Pline_test(int);
-drop function xl_delete_Pline_test(int);
+--GROUPING SETs are not supported
+--xl_items_sold gets distributed by default on HASH(brand)
+-- below test looks to be working fine for data spanning multiple nodes.
+-- However existing groupingsets.sql test is failing for Postgres-XL (Low priority)
+create table xl_items_sold (
+ brand char(20),
+ size_sold char(2),
+ sales integer
+);
+
+insert into xl_items_sold values ('Foo', 'L','10');
+insert into xl_items_sold values ('Foo', 'M','20');
+insert into xl_items_sold values ('Bar', 'M','15');
+insert into xl_items_sold values ('Bar', 'L','5');
+select xl_nodename_from_id(xc_node_id), * from xl_items_sold;
+
+SELECT brand, size_sold, sum(sales) FROM xl_items_sold GROUP BY GROUPING SETS ((brand), (size_sold), ());
+
+drop table xl_items_sold;
+drop function xl_nodename_from_id(integer);
diff --git a/src/test/regress/sql/xl_user_defined_functions.sql b/src/test/regress/sql/xl_user_defined_functions.sql
new file mode 100755
index 0000000000..2aeace6fb4
--- /dev/null
+++ b/src/test/regress/sql/xl_user_defined_functions.sql
@@ -0,0 +1,121 @@
+--User defined functions have several limitations
+--Basic insert, update, delete test on multiple datanodes using plpgsql function is passing.
+
+--default distributed by HASH(slotname)
+
+create function xl_nodename_from_id1(integer) returns name as $$
+declare
+ n name;
+BEGIN
+ select node_name into n from pgxc_node where node_id = $1;
+ RETURN n;
+END;$$ language plpgsql;
+
+create table xl_Pline1 (
+ slotname char(20),
+ phonenumber char(20),
+ comment text,
+ backlink char(20)
+);
+
+create unique index xl_Pline1_name on xl_Pline1 using btree (slotname bpchar_ops);
+
+--insert Plines
+insert into xl_Pline1 values ('PL.001', '-0', 'Central call', 'PS.base.ta1');
+insert into xl_Pline1 values ('PL.002', '-101', '', 'PS.base.ta2');
+insert into xl_Pline1 values ('PL.003', '-102', '', 'PS.base.ta3');
+insert into xl_Pline1 values ('PL.004', '-103', '', 'PS.base.ta5');
+insert into xl_Pline1 values ('PL.005', '-104', '', 'PS.base.ta6');
+insert into xl_Pline1 values ('PL.006', '-106', '', 'PS.base.tb2');
+insert into xl_Pline1 values ('PL.007', '-108', '', 'PS.base.tb3');
+insert into xl_Pline1 values ('PL.008', '-109', '', 'PS.base.tb4');
+insert into xl_Pline1 values ('PL.009', '-121', '', 'PS.base.tb5');
+insert into xl_Pline1 values ('PL.010', '-122', '', 'PS.base.tb6');
+insert into xl_Pline1 values ('PL.011', '-122', '', 'PS.base.tb6');
+insert into xl_Pline1 values ('PL.012', '-122', '', 'PS.base.tb6');
+insert into xl_Pline1 values ('PL.013', '-122', '', 'PS.base.tb6');
+insert into xl_Pline1 values ('PL.014', '-122', '', 'PS.base.tb6');
+insert into xl_Pline1 values ('PL.015', '-134', '', 'PS.first.ta1');
+insert into xl_Pline1 values ('PL.016', '-137', '', 'PS.first.ta3');
+insert into xl_Pline1 values ('PL.017', '-139', '', 'PS.first.ta4');
+insert into xl_Pline1 values ('PL.018', '-362', '', 'PS.first.tb1');
+insert into xl_Pline1 values ('PL.019', '-363', '', 'PS.first.tb2');
+insert into xl_Pline1 values ('PL.020', '-364', '', 'PS.first.tb3');
+insert into xl_Pline1 values ('PL.021', '-365', '', 'PS.first.tb5');
+insert into xl_Pline1 values ('PL.022', '-367', '', 'PS.first.tb6');
+insert into xl_Pline1 values ('PL.023', '-367', '', 'PS.first.tb6');
+insert into xl_Pline1 values ('PL.024', '-367', '', 'PS.first.tb6');
+insert into xl_Pline1 values ('PL.025', '-367', '', 'PS.first.tb6');
+insert into xl_Pline1 values ('PL.026', '-367', '', 'PS.first.tb6');
+insert into xl_Pline1 values ('PL.027', '-367', '', 'PS.first.tb6');
+insert into xl_Pline1 values ('PL.028', '-501', 'Fax entrance', 'PS.base.ta2');
+insert into xl_Pline1 values ('PL.029', '-502', 'Fax first floor', 'PS.first.ta1');
+
+create function xl_insert_Pline_test(int) returns boolean as $$
+BEGIN
+ IF $1 < 20 THEN
+ insert into xl_Pline1 values ('PL.030', '-367', '', 'PS.first.tb6');
+ insert into xl_Pline1 values ('PL.031', '-367', '', 'PS.first.tb6');
+ insert into xl_Pline1 values ('PL.032', '-367', '', 'PS.first.tb6');
+ insert into xl_Pline1 values ('PL.033', '-367', '', 'PS.first.tb6');
+ insert into xl_Pline1 values ('PL.034', '-367', '', 'PS.first.tb6');
+ insert into xl_Pline1 values ('PL.035', '-367', '', 'PS.first.tb6');
+ insert into xl_Pline1 values ('PL.036', '-367', '', 'PS.first.tb6');
+ RETURN TRUE;
+ ELSE
+ RETURN FALSE;
+ END IF;
+END;$$ language plpgsql;
+
+select xl_insert_Pline_test(1);
+
+select xl_nodename_from_id1(xc_node_id), * from xl_Pline1 order by slotname;
+
+
+create function xl_update_Pline_test(int) returns boolean as $$
+BEGIN
+ IF $1 < 20 THEN
+ update xl_Pline1 set phonenumber = '400' where slotname = 'PL.030';
+ update xl_Pline1 set phonenumber = '400' where slotname = 'PL.031';
+ update xl_Pline1 set phonenumber = '400' where slotname = 'PL.032';
+ update xl_Pline1 set phonenumber = '400' where slotname = 'PL.033';
+ update xl_Pline1 set phonenumber = '400' where slotname = 'PL.034';
+ update xl_Pline1 set phonenumber = '400' where slotname = 'PL.035';
+ update xl_Pline1 set phonenumber = '400' where slotname = 'PL.036';
+ RETURN TRUE;
+ ELSE
+ RETURN FALSE;
+ END IF;
+END;$$ language plpgsql;
+
+select xl_update_Pline_test(1);
+
+select xl_nodename_from_id1(xc_node_id), * from xl_Pline1 order by slotname;
+
+create function xl_delete_Pline_test(int) returns boolean as $$
+BEGIN
+ IF $1 < 20 THEN
+ delete from xl_Pline1 where slotname = 'PL.030';
+ delete from xl_Pline1 where slotname = 'PL.031';
+ delete from xl_Pline1 where slotname = 'PL.032';
+ delete from xl_Pline1 where slotname = 'PL.033';
+ delete from xl_Pline1 where slotname = 'PL.034';
+ delete from xl_Pline1 where slotname = 'PL.035';
+ delete from xl_Pline1 where slotname = 'PL.036';
+
+ RETURN TRUE;
+ ELSE
+ RETURN FALSE;
+ END IF;
+END;$$ language plpgsql;
+
+select xl_delete_Pline_test(1);
+
+select xl_nodename_from_id1(xc_node_id), * from xl_Pline1 order by slotname;
+
+drop table xl_Pline1;
+drop function xl_nodename_from_id1(integer);
+
+drop function xl_insert_Pline_test(int);
+drop function xl_update_Pline_test(int);
+drop function xl_delete_Pline_test(int);