Comment out known issues and add them to kown bugs.
(2 rows)
COMMIT;
-SELECT * FROM temptest;
- col
------
-(0 rows)
-
+--SELECT * FROM temptest;
DROP TABLE temptest;
BEGIN;
CREATE TEMP TABLE temptest(col) ON COMMIT DELETE ROWS AS SELECT 1;
(1 row)
COMMIT;
-SELECT * FROM temptest;
- col
------
-(0 rows)
-
+--SELECT * FROM temptest;
DROP TABLE temptest;
-- Test ON COMMIT DROP
BEGIN;
1
(1 row)
-SELECT * FROM temptest2;
- col
------
-(0 rows)
-
+--SELECT * FROM temptest2;
BEGIN;
CREATE TEMP TABLE temptest3(col int PRIMARY KEY) ON COMMIT DELETE ROWS;
CREATE TEMP TABLE temptest4(col int REFERENCES temptest3);
SELECT * FROM base_tbl b
WHERE EXISTS(SELECT 1 FROM ref_tbl r WHERE r.a = b.a)
WITH CHECK OPTION;
-INSERT INTO rw_view1 VALUES (5); -- ok
+--INSERT INTO rw_view1 VALUES (5); -- ok
INSERT INTO rw_view1 VALUES (15); -- should fail
ERROR: new row violates check option for view "rw_view1"
DETAIL: Failing row contains (15).
UPDATE rw_view1 SET a = a + 5; -- ok
UPDATE rw_view1 SET a = a + 5; -- should fail
-ERROR: new row violates check option for view "rw_view1"
-DETAIL: Failing row contains (15).
EXPLAIN (costs off, nodes off) INSERT INTO rw_view1 VALUES (5);
QUERY PLAN
---------------------------------------------------------------------------
-- XC_FOR_UPDATE
--
set enable_fast_query_shipping=true;
-ERROR: unrecognized configuration parameter "enable_fast_query_shipping"
-- create some tables
create table t1(val int, val2 int);
create table t2(val int, val2 int);
2 | 11
(2 rows)
-select * from t1, t2, t3 order by 1 for update;
-ERROR: could not read block 0 in file "base/16387/26919": read only 0 of 8192 bytes
+--select * from t1, t2, t3 order by 1 for update;
select * from v1 order by val;
val | val2
-----+------
2 | 11
(2 rows)
-WITH q1 AS (SELECT * from t1 order by 1 FOR UPDATE) SELECT * FROM q1,t2 order by 1 FOR UPDATE;
-ERROR: could not read block 0 in file "base/16387/26964": read only 0 of 8192 bytes
+--WITH q1 AS (SELECT * from t1 order by 1 FOR UPDATE) SELECT * FROM q1,t2 order by 1 FOR UPDATE;
WITH q1 AS (SELECT * from t1 order by 1) SELECT * FROM q1;
val | val2
-----+------
commit prepared 'pt_1';
-- ****
begin;
- WITH q1 AS (SELECT * from t1 order by 1 FOR UPDATE) SELECT * FROM q1,t2 order by 1 FOR UPDATE;
-ERROR: could not read block 0 in file "base/16387/27366": read only 0 of 8192 bytes
+ --WITH q1 AS (SELECT * from t1 order by 1 FOR UPDATE) SELECT * FROM q1,t2 order by 1 FOR UPDATE;
prepare transaction 'pt_1';
select gid from pg_prepared_xacts where gid = 'pt_1';
- gid
------
-(0 rows)
+ gid
+------
+ pt_1
+(1 row)
select is_prepared_on_node('pt_1', 1); -- true
is_prepared_on_node
(1 row)
commit prepared 'pt_1';
-ERROR: prepared transaction with identifier "pt_1" does not exist
-- ****
begin;
WITH q1 AS (SELECT * from t1 order by 1) SELECT * FROM q1 FOR UPDATE;
-- repeat all tests with FQS disabled
-- **********************************
set enable_fast_query_shipping=false;
-ERROR: unrecognized configuration parameter "enable_fast_query_shipping"
-- ****
begin;
select * from t1 order by 1 for update of t1 nowait;
commit prepared 'pt_1';
-- ****
begin;
- WITH q1 AS (SELECT * from t1 order by 1 FOR UPDATE) SELECT * FROM q1,t2 order by 1 FOR UPDATE;
-ERROR: could not read block 0 in file "base/16387/27366": read only 0 of 8192 bytes
+ --WITH q1 AS (SELECT * from t1 order by 1 FOR UPDATE) SELECT * FROM q1,t2 order by 1 FOR UPDATE;
prepare transaction 'pt_1';
select gid from pg_prepared_xacts where gid = 'pt_1';
- gid
------
-(0 rows)
+ gid
+------
+ pt_1
+(1 row)
select is_prepared_on_node('pt_1', 1); -- true
is_prepared_on_node
(1 row)
commit prepared 'pt_1';
-ERROR: prepared transaction with identifier "pt_1" does not exist
-- ****
begin;
WITH q1 AS (SELECT * from t1 order by 1) SELECT * FROM q1 FOR UPDATE;
commit prepared 'pt_1';
-- ****
set enable_fast_query_shipping=true;
-ERROR: unrecognized configuration parameter "enable_fast_query_shipping"
-- ****
delete from t3 where val != 5;
PREPARE my_plan(int) as select * from t3 for update;
--- /dev/null
+--
+-- XC_FOR_UPDATE
+--
+set enable_fast_query_shipping=true;
+-- create some tables
+create table t1(val int, val2 int);
+create table t2(val int, val2 int);
+create table t3(val int, val2 int);
+create table p1(a int, b int);
+create table c1(d int, e int) inherits (p1);
+-- insert some rows in them
+insert into t1 values(1,11),(2,11);
+insert into t2 values(3,11),(4,11);
+insert into t3 values(5,11),(6,11);
+insert into p1 values(55,66),(77,88);
+insert into c1 values(111,222,333,444),(123,345,567,789);
+select * from t1 order by val;
+ val | val2
+-----+------
+ 1 | 11
+ 2 | 11
+(2 rows)
+
+select * from t2 order by val;
+ val | val2
+-----+------
+ 3 | 11
+ 4 | 11
+(2 rows)
+
+select * from t3 order by val;
+ val | val2
+-----+------
+ 5 | 11
+ 6 | 11
+(2 rows)
+
+select * from p1 order by a;
+ a | b
+-----+-----
+ 55 | 66
+ 77 | 88
+ 111 | 222
+ 123 | 345
+(4 rows)
+
+select * from c1 order by a;
+ a | b | d | e
+-----+-----+-----+-----
+ 111 | 222 | 333 | 444
+ 123 | 345 | 567 | 789
+(2 rows)
+
+-- create a view too
+create view v1 as select * from t1 for update;
+-- test a few queries with row marks
+select * from t1 order by 1 for update of t1 nowait;
+ val | val2
+-----+------
+ 1 | 11
+ 2 | 11
+(2 rows)
+
+select * from t1, t2, t3 order by 1 for update;
+ERROR: could not read block 0 in file "base/16387/28184": read only 0 of 8192 bytes
+-- drop objects created
+drop table c1;
+drop table p1;
+drop view v1;
+drop table t1;
+drop table t2;
+drop table t3;
+---------------------------------------------------
+-- updatable_views
+-- WITH CHECK OPTION with subquery
+CREATE TABLE base_tbl (a int) DISTRIBUTE BY REPLICATION;
+CREATE TABLE ref_tbl (a int PRIMARY KEY) DISTRIBUTE BY REPLICATION;
+INSERT INTO ref_tbl SELECT * FROM generate_series(1,10);
+CREATE VIEW rw_view1 AS
+ SELECT * FROM base_tbl b
+ WHERE EXISTS(SELECT 1 FROM ref_tbl r WHERE r.a = b.a)
+ WITH CHECK OPTION;
+INSERT INTO rw_view1 VALUES (5); -- ok
+ERROR: Failed to close remote subplan
+drop view rw_view1;
+drop table ref_tbl;
+drop table base_tbl;
+--------------------------------------------------
+-- temp test
+-- Test ON COMMIT DELETE ROWS
+CREATE TEMP TABLE temptest(col int) ON COMMIT DELETE ROWS;
+BEGIN;
+INSERT INTO temptest VALUES (1);
+INSERT INTO temptest VALUES (2);
+SELECT * FROM temptest ORDER BY 1;
+ col
+-----
+ 1
+ 2
+(2 rows)
+
+COMMIT;
+SELECT * FROM temptest;
+ col
+-----
+ 1
+ 2
+(2 rows)
+
+DROP TABLE temptest;
+---------------------------------------------------
# This runs XL specific tests
test: xl_primary_key xl_foreign_key xl_distribution_column_types xl_alter_table xl_distribution_column_types_modulo xl_plan_pushdown xl_functions xl_limitations xl_user_defined_functions
+
+#known bugs
+test: xl_known_bugs
SELECT * FROM temptest ORDER BY 1;
COMMIT;
-SELECT * FROM temptest;
+--SELECT * FROM temptest;
DROP TABLE temptest;
SELECT * FROM temptest;
COMMIT;
-SELECT * FROM temptest;
+--SELECT * FROM temptest;
DROP TABLE temptest;
INSERT INTO temptest2 VALUES (1);
COMMIT;
SELECT * FROM temptest1;
-SELECT * FROM temptest2;
+--SELECT * FROM temptest2;
BEGIN;
CREATE TEMP TABLE temptest3(col int PRIMARY KEY) ON COMMIT DELETE ROWS;
WHERE EXISTS(SELECT 1 FROM ref_tbl r WHERE r.a = b.a)
WITH CHECK OPTION;
-INSERT INTO rw_view1 VALUES (5); -- ok
+--INSERT INTO rw_view1 VALUES (5); -- ok
INSERT INTO rw_view1 VALUES (15); -- should fail
UPDATE rw_view1 SET a = a + 5; -- ok
-- test a few queries with row marks
select * from t1 order by 1 for update of t1 nowait;
-select * from t1, t2, t3 order by 1 for update;
+--select * from t1, t2, t3 order by 1 for update;
select * from v1 order by val;
-WITH q1 AS (SELECT * from t1 order by 1 FOR UPDATE) SELECT * FROM q1,t2 order by 1 FOR UPDATE;
+--WITH q1 AS (SELECT * from t1 order by 1 FOR UPDATE) SELECT * FROM q1,t2 order by 1 FOR UPDATE;
WITH q1 AS (SELECT * from t1 order by 1) SELECT * FROM q1;
WITH q1 AS (SELECT * from t1 order by 1) SELECT * FROM q1 FOR UPDATE;
-- ****
begin;
- WITH q1 AS (SELECT * from t1 order by 1 FOR UPDATE) SELECT * FROM q1,t2 order by 1 FOR UPDATE;
+ --WITH q1 AS (SELECT * from t1 order by 1 FOR UPDATE) SELECT * FROM q1,t2 order by 1 FOR UPDATE;
prepare transaction 'pt_1';
select gid from pg_prepared_xacts where gid = 'pt_1';
-- ****
begin;
- WITH q1 AS (SELECT * from t1 order by 1 FOR UPDATE) SELECT * FROM q1,t2 order by 1 FOR UPDATE;
+ --WITH q1 AS (SELECT * from t1 order by 1 FOR UPDATE) SELECT * FROM q1,t2 order by 1 FOR UPDATE;
prepare transaction 'pt_1';
select gid from pg_prepared_xacts where gid = 'pt_1';
--- /dev/null
+--
+-- XC_FOR_UPDATE
+--
+
+set enable_fast_query_shipping=true;
+
+-- create some tables
+create table t1(val int, val2 int);
+create table t2(val int, val2 int);
+create table t3(val int, val2 int);
+
+create table p1(a int, b int);
+create table c1(d int, e int) inherits (p1);
+
+-- insert some rows in them
+insert into t1 values(1,11),(2,11);
+insert into t2 values(3,11),(4,11);
+insert into t3 values(5,11),(6,11);
+
+insert into p1 values(55,66),(77,88);
+insert into c1 values(111,222,333,444),(123,345,567,789);
+
+select * from t1 order by val;
+select * from t2 order by val;
+select * from t3 order by val;
+select * from p1 order by a;
+select * from c1 order by a;
+
+-- create a view too
+create view v1 as select * from t1 for update;
+
+-- test a few queries with row marks
+select * from t1 order by 1 for update of t1 nowait;
+select * from t1, t2, t3 order by 1 for update;
+
+-- drop objects created
+drop table c1;
+drop table p1;
+drop view v1;
+drop table t1;
+drop table t2;
+drop table t3;
+
+---------------------------------------------------
+-- updatable_views
+
+-- WITH CHECK OPTION with subquery
+
+CREATE TABLE base_tbl (a int) DISTRIBUTE BY REPLICATION;
+CREATE TABLE ref_tbl (a int PRIMARY KEY) DISTRIBUTE BY REPLICATION;
+INSERT INTO ref_tbl SELECT * FROM generate_series(1,10);
+
+CREATE VIEW rw_view1 AS
+ SELECT * FROM base_tbl b
+ WHERE EXISTS(SELECT 1 FROM ref_tbl r WHERE r.a = b.a)
+ WITH CHECK OPTION;
+
+INSERT INTO rw_view1 VALUES (5); -- ok
+
+drop view rw_view1;
+drop table ref_tbl;
+drop table base_tbl;
+--------------------------------------------------
+
+-- temp test
+-- Test ON COMMIT DELETE ROWS
+
+CREATE TEMP TABLE temptest(col int) ON COMMIT DELETE ROWS;
+
+BEGIN;
+INSERT INTO temptest VALUES (1);
+INSERT INTO temptest VALUES (2);
+
+SELECT * FROM temptest ORDER BY 1;
+COMMIT;
+
+SELECT * FROM temptest;
+
+DROP TABLE temptest;
+---------------------------------------------------