summaryrefslogtreecommitdiff
path: root/src/test/regress/sql/xl_sqlsmith_bugs.sql
blob: 41c118c2c3123c3c913bced6fdbac0284fbf815d (plain)
1
2
3
4
5
6
7
8
9
10
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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
-- #93
-- SQLsmith: ERROR: invalid regexp option:

select
          subq_28.c0 as c0,
          subq_29.c0 as c1
        from
          (select
                  83 as c0,
                  sample_76.nodeoids as c1,
                  7 as c2
                from
                  pg_catalog.pgxc_class as sample_76 tablesample system (1)
                where (select character_maximum_length from information_schema.domains limit 1 offset 36)
         < sample_76.pchashbuckets) as subq_28
            right join (select
                  sample_77.objoid as c0,
                  sample_77.objoid as c1,
                  52 as c2,
                  pg_catalog.random() as c3,
                  sample_77.description as c4,
                  sample_77.objsubid as c5,
                  53 as c6,
                  73 as c7,
                  sample_77.objsubid as c8
                from
                  pg_catalog.pg_description as sample_77 tablesample bernoulli (4.5)
                where sample_77.objoid <> sample_77.classoid
                limit 174) as subq_29
            on (subq_28.c0 = subq_29.c2 )
        where (53 = pg_catalog.char_length(
              cast(pg_catalog.regexp_replace(
                cast(subq_29.c4 as text),


                cast(subq_29.c4 as text),


                cast(subq_29.c4 as text),


                cast(pg_catalog.timeofday() as text)) as text)))
          and ((subq_29.c7 is NULL)
            or ((subq_28.c2 <= 68)
              or ((select character_maximum_length from information_schema.domains limit 1 offset 39)
         <= 100)))
        limit 94;

-- #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:

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;


insert into public.xl_join_t1 values (
        (select character_maximum_length from information_schema.routines limit 1 offset 15)
        ,
        33);

DROP TABLE xl_join_t1;
DROP TABLE xl_join_t2;
DROP TABLE xl_join_t3;

-- #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);
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
  cast(coalesce(8,
    (select pid from pg_catalog.pg_stat_activity limit 1 offset 29)
) as integer) as c0,
  33 as c1,
  (select objsubid from pg_catalog.pg_seclabel limit 1 offset 34)
 as c2,
  (select ordinal_position from information_schema.parameters limit 1 offset 1)
 as c3,
  cast(coalesce(pg_catalog.pg_postmaster_start_time(),
      pg_catalog.min(
        cast(null as timestamp with time zone)) over (partition by subq_1.c1 order by subq_1.c1,subq_1.c5)) as timestamp with time zone) as c4,
  (select character_maximum_length from information_schema.domains limit 1 offset 36)
 as c5
from
  (select
        (select character_maximum_length from information_schema.user_defined_types limit 1 offset 6)
 as c0,
        sample_7.conpfeqop as c1,
        sample_6.amprocfamily as c2,
          pg_catalog.string_agg(
            cast(sample_7.consrc as text),
            cast(sample_7.consrc as text)) over (partition by sample_6.amprocrighttype order by sample_6.amprocfamily,sample_6.amprocrighttype) as c3,
        34 as c4,
        pg_catalog.abs(
          cast(cast(coalesce((select total_time from pg_catalog.pg_stat_user_functions limit 1 offset 6)
,
            null) as double precision) as double precision)) as c5
      from
        pg_catalog.pg_amop as ref_11
            left join pg_catalog.pg_amproc as sample_6 tablesample system (7)
            on (ref_11.amopmethod = sample_6.amprocfamily )
          inner join pg_catalog.pg_constraint as sample_7 tablesample system (9.5)
          on (ref_11.amopsortfamily = sample_7.connamespace ),
        lateral (select
              ref_11.amopmethod as c0
            from
              pg_catalog.pg_user_mapping as ref_12
            where ((sample_7.confdeltype is NULL)
                and (((select character_maximum_length from information_schema.element_types limit 1 offset 16)
 >= 39)
                  and (99 > (select objsubid from pg_catalog.pg_depend limit 1 offset 10)
)))
              or (59 <> 82)
            limit 75) as subq_0
      where EXISTS (
        select
            76 as c0,
            ref_13.val2 as c1,
            7 as c2,
            pg_catalog.has_server_privilege(
              cast(null as oid),
              cast(pg_catalog.to_hex(
                cast(null as bigint)) as text),
              cast(null as text)) as c3,
              pg_catalog.bit_out(
              cast(null as bit)) as c4,
              pg_catalog.int82ge(
              cast(pg_catalog.pg_stat_get_db_conflict_snapshot(
                cast(pg_catalog.pg_my_temp_schema() as oid)) as bigint),
              cast(null as smallint)) as c5,
              ref_13.val1 as c6
          from
              public.xl_join_t3 as ref_13
          where (ref_13.val2 = pg_catalog.pg_stat_get_xact_tuples_inserted(
                cast(pg_catalog.lo_import(
                  cast((select name from pg_catalog.pg_cursors limit 1 offset 21)
 as text)) as oid)))
              or (25 > (select ordinal_position from information_schema.attributes limit 1 offset 17)
))
      limit 87) as subq_1
where
cast(coalesce((select node_port from pg_catalog.pgxc_node limit 1 offset 9)
,
    cast(coalesce(pg_catalog.pg_backend_pid(),
      subq_1.c0) as integer)) as integer) is NULL;


DROP TABLE xl_join_t1;
DROP TABLE xl_join_t2;
DROP TABLE xl_join_t3;