+-- #91
+-- SQLsmith: ERROR: int2_accum_inv called with NULL state
+SET sequence_range = 1;
+CREATE SEQUENCE xl_INSERT_SEQ;
+CREATE TABLE xl_funct (
+ a integer,
+ b INT DEFAULT nextval('xl_insert_seq')
+) DISTRIBUTE BY HASH (a);
+INSERT INTO xl_funct (a) VALUES (1);
+INSERT INTO xl_funct (a) VALUES (2);
+INSERT INTO xl_funct (a) VALUES (3);
+SELECT * FROM xl_funct;
+ a | b
+---+---
+ 1 | 1
+ 2 | 2
+ 3 | 3
+(3 rows)
+
+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
+ subq_3.c1 as c0,
+ subq_9.c0 as c1
+ from
+ (select
+ subq_2.c1 as c0,
+ 50 as c1
+ from
+ pg_catalog.pg_pltemplate as sample_2 tablesample system (4.6) ,
+ lateral (select
+ sample_2.tmpldbacreate as c0,
+ pg_catalog.pg_advisory_unlock_all() as c1,
+ sample_2.tmplvalidator as c2
+ from
+ public.xl_join_t3 as sample_3 tablesample bernoulli (9.2)
+ where sample_3.val1 <> pg_catalog.txid_current()
+ limit 55) as subq_2
+ where 92 >= pg_catalog.pg_event_trigger_table_rewrite_reason()
+ limit 60) as subq_3
+ inner join (select
+ sample_10.b as c0
+ from
+ public.xl_funct as sample_10 tablesample system (1.8)
+ where sample_10.b < sample_10.a
+ limit 42) as subq_9
+ right join (select
+ 41 as c0,
+ sample_11.rngsubdiff as c1
+ from
+ pg_catalog.pg_range as sample_11 tablesample system (9.4)
+ where (pg_catalog.numeric_accum_inv(
+ cast(null as numeric_agg_state),
+ cast(null as numeric)) is NULL)
+ and (sample_11.rngsubopc <> sample_11.rngsubopc)
+ limit 130) as subq_10
+ on (subq_9.c0 = subq_10.c0 )
+ on (subq_3.c1 = subq_10.c0 )
+ where subq_9.c0 <> subq_9.c0;
+DROP TABLE xl_join_t1;
+DROP TABLE xl_join_t2;
+DROP TABLE xl_join_t3;
+DROP SEQUENCE xl_INSERT_SEQ cascade;
+NOTICE: drop cascades to default for table xl_funct column b
+DROP TABLE xl_funct;
-- #88
-- SQLsmith: Error: unsupported data type for HASH locator:
CREATE TABLE xl_join_t1 (val1 int, val2 int);
+-- #91
+-- SQLsmith: ERROR: int2_accum_inv called with NULL state
+
+SET sequence_range = 1;
+CREATE SEQUENCE xl_INSERT_SEQ;
+
+CREATE TABLE xl_funct (
+ a integer,
+ b INT DEFAULT nextval('xl_insert_seq')
+) DISTRIBUTE BY HASH (a);
+
+INSERT INTO xl_funct (a) VALUES (1);
+INSERT INTO xl_funct (a) VALUES (2);
+INSERT INTO xl_funct (a) VALUES (3);
+SELECT * FROM xl_funct;
+
+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
+ subq_3.c1 as c0,
+ subq_9.c0 as c1
+ from
+ (select
+ subq_2.c1 as c0,
+ 50 as c1
+ from
+ pg_catalog.pg_pltemplate as sample_2 tablesample system (4.6) ,
+ lateral (select
+ sample_2.tmpldbacreate as c0,
+ pg_catalog.pg_advisory_unlock_all() as c1,
+ sample_2.tmplvalidator as c2
+ from
+ public.xl_join_t3 as sample_3 tablesample bernoulli (9.2)
+ where sample_3.val1 <> pg_catalog.txid_current()
+ limit 55) as subq_2
+ where 92 >= pg_catalog.pg_event_trigger_table_rewrite_reason()
+ limit 60) as subq_3
+ inner join (select
+ sample_10.b as c0
+ from
+ public.xl_funct as sample_10 tablesample system (1.8)
+ where sample_10.b < sample_10.a
+ limit 42) as subq_9
+ right join (select
+ 41 as c0,
+ sample_11.rngsubdiff as c1
+ from
+ pg_catalog.pg_range as sample_11 tablesample system (9.4)
+ where (pg_catalog.numeric_accum_inv(
+ cast(null as numeric_agg_state),
+
+
+ cast(null as numeric)) is NULL)
+ and (sample_11.rngsubopc <> sample_11.rngsubopc)
+ limit 130) as subq_10
+ on (subq_9.c0 = subq_10.c0 )
+ on (subq_3.c1 = subq_10.c0 )
+ where subq_9.c0 <> subq_9.c0;
+DROP TABLE xl_join_t1;
+DROP TABLE xl_join_t2;
+DROP TABLE xl_join_t3;
+DROP SEQUENCE xl_INSERT_SEQ cascade;
+DROP TABLE xl_funct;
+
-- #88
-- SQLsmith: Error: unsupported data type for HASH locator: