From: Pallavi Sontakke Date: Tue, 19 Jul 2016 08:35:21 +0000 (+0530) Subject: Add test case for Issue #87 X-Git-Tag: XL9_5_R1_2~19 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=dbaa6160d4f3cedabb93d62f40b76b705b2b130e;p=postgres-xl.git Add test case for Issue #87 --- diff --git a/src/test/regress/expected/xl_sqlsmith_bugs.out b/src/test/regress/expected/xl_sqlsmith_bugs.out index c346fc8c3b..71c7c8c7da 100644 --- a/src/test/regress/expected/xl_sqlsmith_bugs.out +++ b/src/test/regress/expected/xl_sqlsmith_bugs.out @@ -1,3 +1,129 @@ +-- #87 +-- SQLsmith error: cache lookup failed for function 0 +CREATE TABLE xl_join_t1 (val1 int, val2 int); +CREATE TABLE xl_join_t2 (val1 int, val2 int); +CREATE TABLE xl_join_t3 (val1 int, val2 int); +INSERT INTO xl_join_t1 VALUES (1,10),(2,20); +INSERT INTO xl_join_t2 VALUES (3,30),(4,40); +INSERT INTO xl_join_t3 VALUES (5,50),(6,60); +EXPLAIN SELECT * FROM xl_join_t1 + INNER JOIN xl_join_t2 ON xl_join_t1.val1 = xl_join_t2.val2 + INNER JOIN xl_join_t3 ON xl_join_t1.val1 = xl_join_t3.val1; + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------- + Remote Subquery Scan on all (datanode_1,datanode_2) (cost=475.52..5209.87 rows=288579 width=24) + -> Merge Join (cost=475.52..5209.87 rows=288579 width=24) + Merge Cond: (xl_join_t3.val1 = xl_join_t1.val1) + -> Sort (cost=158.51..164.16 rows=2260 width=8) + Sort Key: xl_join_t3.val1 + -> Seq Scan on xl_join_t3 (cost=0.00..32.60 rows=2260 width=8) + -> Materialize (cost=317.01..775.23 rows=25538 width=16) + -> Merge Join (cost=317.01..711.38 rows=25538 width=16) + Merge Cond: (xl_join_t2.val2 = xl_join_t1.val1) + -> Remote Subquery Scan on all (datanode_1,datanode_2) (cost=100.00..161.98 rows=2260 width=8) + Distribute results by H: val2 + -> Sort (cost=287.89..293.54 rows=2260 width=8) + Sort Key: xl_join_t2.val2 + -> Seq Scan on xl_join_t2 (cost=0.00..32.60 rows=2260 width=8) + -> Sort (cost=158.51..164.16 rows=2260 width=8) + Sort Key: xl_join_t1.val1 + -> Seq Scan on xl_join_t1 (cost=0.00..32.60 rows=2260 width=8) +(17 rows) + +SELECT * FROM xl_join_t1 + INNER JOIN xl_join_t2 ON xl_join_t1.val1 = xl_join_t2.val2 + INNER JOIN xl_join_t3 ON xl_join_t1.val1 = xl_join_t3.val1; + val1 | val2 | val1 | val2 | val1 | val2 +------+------+------+------+------+------ +(0 rows) + +select + 55 as c0, + subq_3.c0 as c1, + subq_3.c1 as c2 + from + (select + subq_0.c4 as c0, + subq_0.c3 as c1, + subq_0.c1 as c2, + pg_catalog.pg_backend_pid() as c3, + 39 as c4, + 50 as c5, + (select conforencoding from pg_catalog.pg_conversion limit 1 offset 8) + as c6 + from + (select + 81 as c0, + sample_1.val2 as c1, + (select ordinal_position from information_schema.columns limit 1 offset 29) + as c2, + sample_1.val1 as c3, + sample_1.val2 as c4 + from + public.xl_join_t3 as sample_1 tablesample system (5.5) + where true) as subq_0, + lateral (select + 75 as c0 + from + information_schema.routines as ref_1, + lateral (select + 32 as c0 + from + pg_catalog.pg_database as sample_2 tablesample system (9.1) + where ((select pid from pg_catalog.pg_stat_activity limit 1 offset 1) + > (select ordinal_position from information_schema.attributes limit 1 offset 36) + ) + and (subq_0.c0 <> subq_0.c1) + limit 64) as subq_1 + where pg_catalog.pg_get_function_identity_arguments( + cast(pg_catalog.pg_my_temp_schema() as oid)) is NULL) as subq_2 + where ((select pid from pg_catalog.pg_stat_activity limit 1 offset 22) + <= 50) + or ((72 <= subq_0.c2) + and (((98 >= subq_0.c0) + and (subq_2.c0 <> (select character_maximum_length from information_schema.element_types limit 1 offset 30) + )) + and (EXISTS ( + select + ref_2.collation_name as c0, + ref_2.scope_schema as c1, + 47 as c2, + pg_catalog.pgxc_pool_check() as c3, + 76 as c4, + 83 as c5, + pg_catalog.current_user() as c6 + from + information_schema.element_types as ref_2 + where pg_catalog.time_pl_interval( + cast(pg_catalog.time( + cast(null as timestamp without time zone)) as time without time zone), + cast(null as interval)) is NULL + limit 129))))) as subq_3 + inner join (select + sample_3.classoid as c0, + 23 as c1, + pg_catalog.current_user() as c2, + cast(coalesce((select ordinal_position from information_schema.parameters limit 1 offset 5) + , + 95) as integer) as c3 + from + pg_catalog.pg_description as sample_3 tablesample system (9.1) + where sample_3.description !~ sample_3.description + limit 46) as subq_4 + on (subq_3.c5 = subq_4.c1 ), + lateral (select + pg_catalog.pg_last_xlog_receive_location() as c0, + sample_4.setrole as c1, + pg_catalog.pg_stat_get_buf_alloc() as c2 + from + pg_catalog.pg_db_role_setting as sample_4 tablesample bernoulli (1.8) + where subq_3.c5 > (select character_maximum_length from information_schema.element_types limit 1 offset 16) + limit 120) as subq_5 + where true + limit 87; +DROP TABLE xl_join_t1; +DROP TABLE xl_join_t2; +DROP TABLE xl_join_t3; -- #102 Issue CREATE TABLE xl_join_t1 (val1 int, val2 int); CREATE TABLE xl_join_t2 (val1 int, val2 int); diff --git a/src/test/regress/sql/xl_sqlsmith_bugs.sql b/src/test/regress/sql/xl_sqlsmith_bugs.sql index 3c0019f4fd..1000fe059e 100644 --- a/src/test/regress/sql/xl_sqlsmith_bugs.sql +++ b/src/test/regress/sql/xl_sqlsmith_bugs.sql @@ -1,3 +1,114 @@ +-- #87 +-- SQLsmith error: cache lookup failed for function 0 + +CREATE TABLE xl_join_t1 (val1 int, val2 int); +CREATE TABLE xl_join_t2 (val1 int, val2 int); +CREATE TABLE xl_join_t3 (val1 int, val2 int); +INSERT INTO xl_join_t1 VALUES (1,10),(2,20); +INSERT INTO xl_join_t2 VALUES (3,30),(4,40); +INSERT INTO xl_join_t3 VALUES (5,50),(6,60); +EXPLAIN SELECT * FROM xl_join_t1 + INNER JOIN xl_join_t2 ON xl_join_t1.val1 = xl_join_t2.val2 + INNER JOIN xl_join_t3 ON xl_join_t1.val1 = xl_join_t3.val1; +SELECT * FROM xl_join_t1 + INNER JOIN xl_join_t2 ON xl_join_t1.val1 = xl_join_t2.val2 + INNER JOIN xl_join_t3 ON xl_join_t1.val1 = xl_join_t3.val1; + +select + 55 as c0, + subq_3.c0 as c1, + subq_3.c1 as c2 + from + (select + subq_0.c4 as c0, + subq_0.c3 as c1, + subq_0.c1 as c2, + pg_catalog.pg_backend_pid() as c3, + 39 as c4, + 50 as c5, + (select conforencoding from pg_catalog.pg_conversion limit 1 offset 8) + as c6 + from + (select + 81 as c0, + sample_1.val2 as c1, + (select ordinal_position from information_schema.columns limit 1 offset 29) + as c2, + sample_1.val1 as c3, + sample_1.val2 as c4 + from + public.xl_join_t3 as sample_1 tablesample system (5.5) + where true) as subq_0, + lateral (select + 75 as c0 + from + information_schema.routines as ref_1, + lateral (select + 32 as c0 + from + pg_catalog.pg_database as sample_2 tablesample system (9.1) + where ((select pid from pg_catalog.pg_stat_activity limit 1 offset 1) + > (select ordinal_position from information_schema.attributes limit 1 offset 36) + ) + and (subq_0.c0 <> subq_0.c1) + limit 64) as subq_1 + where pg_catalog.pg_get_function_identity_arguments( + cast(pg_catalog.pg_my_temp_schema() as oid)) is NULL) as subq_2 + where ((select pid from pg_catalog.pg_stat_activity limit 1 offset 22) + <= 50) + or ((72 <= subq_0.c2) + and (((98 >= subq_0.c0) + and (subq_2.c0 <> (select character_maximum_length from information_schema.element_types limit 1 offset 30) + )) + and (EXISTS ( + select + ref_2.collation_name as c0, + ref_2.scope_schema as c1, + 47 as c2, + pg_catalog.pgxc_pool_check() as c3, + 76 as c4, + 83 as c5, + pg_catalog.current_user() as c6 + from + information_schema.element_types as ref_2 + where pg_catalog.time_pl_interval( + cast(pg_catalog.time( + cast(null as timestamp without time zone)) as time without time zone), + + + cast(null as interval)) is NULL + limit 129))))) as subq_3 + inner join (select + sample_3.classoid as c0, + 23 as c1, + pg_catalog.current_user() as c2, + cast(coalesce((select ordinal_position from information_schema.parameters limit 1 offset 5) + , + + 95) as integer) as c3 + from + pg_catalog.pg_description as sample_3 tablesample system (9.1) + where sample_3.description !~ sample_3.description + limit 46) as subq_4 + on (subq_3.c5 = subq_4.c1 ), + lateral (select + pg_catalog.pg_last_xlog_receive_location() as c0, + sample_4.setrole as c1, + pg_catalog.pg_stat_get_buf_alloc() as c2 + from + pg_catalog.pg_db_role_setting as sample_4 tablesample bernoulli (1.8) + where subq_3.c5 > (select character_maximum_length from information_schema.element_types limit 1 offset 16) + + limit 120) as subq_5 + where true + limit 87; + +DROP TABLE xl_join_t1; +DROP TABLE xl_join_t2; +DROP TABLE xl_join_t3; + + + -- #102 Issue CREATE TABLE xl_join_t1 (val1 int, val2 int); CREATE TABLE xl_join_t2 (val1 int, val2 int);