Hi everyone,
Here's another crash caught by sqlsmith.
"""
drop table if exists fkpart3_pk5 cascade;
drop table if exists inet_tbl;
create table fkpart3_pk5 (
a integer not null primary key
)
partition by range (a);
create table fkpart3_pk51 partition of fkpart3_pk5
for values from (4000) to (4500);
create table inet_tbl (
c cidr,
i inet
);
select
1 as c0
from
(select null::integer as c9,
ref_0.a as c24
from fkpart3_pk5 as ref_0
) as subq_0
right join public.inet_tbl as sample_0 on (cast(null as cidr) = c)
where subq_0.c9 <= subq_0.c24
"""
Attached the backtrace.
--
Jaime Casanova
Director de Servicios Profesionales
SystemGuards - Consultores de PostgreSQL
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
set = {__val = {4194304, 140736805622640, 2, 6, 6666556,
94745029079040,
4611686018427388799, 139894076431014, 0, 281470681751456, 0, 0, 0,
0, 0, 0}}
pid = <optimized out>
tid = <optimized out>
ret = <optimized out>
#1 0x00007f3ba0830535 in __GI_abort () at abort.c:79
save_stage = 1
act = {__sigaction_handler = {sa_handler = 0x0, sa_sigaction = 0x0},
sa_mask = {__val = {
0, 0, 0, 0, 0, 139894074187765, 2, 7075777569425871984,
7003713384980111928,
94745029079040, 7003719963994515424, 0, 9449567279706640128,
140736805622880, 0,
140736805623744}}, sa_flags = -1949470720, sa_restorer = 0x0}
sigs = {__val = {32, 0 <repeats 15 times>}}
#2 0x0000562b8c3818a0 in ExceptionalCondition (
conditionName=0x562b8c527e38 "!bms_overlap(baserel->relids,
required_outer)",
errorType=0x562b8c527a26 "FailedAssertion", fileName=0x562b8c527abf
"relnode.c",
lineNumber=1313) at assert.c:69
No locals.
#3 0x0000562b8c0ef355 in get_baserel_parampathinfo (root=0x562b8d3ebd00,
baserel=0x562b8d3e8ec0, required_outer=0x562b8d40e350) at relnode.c:1313
ppi = 0x562b8d3e8ec0
joinrelids = 0x562b8d40f468
pclauses = 0x562b8d40e490
rows = 6.9533220764192298e-310
lc = 0x562b8d40f4c0
#4 0x0000562b8c0debbd in create_append_path (root=0x562b8d3ebd00,
rel=0x562b8d3e8ec0,
subpaths=0x562b8d40f468, partial_subpaths=0x0, pathkeys=0x0,
required_outer=0x562b8d40e350,
parallel_workers=0, parallel_aware=false, rows=-1) at pathnode.c:1270
pathnode = 0x562b8d40f4c0
l = 0x0
#5 0x0000562b8c06ff7c in add_paths_to_append_rel (root=0x562b8d3ebd00,
rel=0x562b8d3e8ec0,
live_childrels=0x562b8d40f060) at allpaths.c:1610
required_outer = 0x562b8d40e350
lcr = 0x0
l__state = {l = 0x562b8d40f1c0, i = 0}
subpaths = 0x562b8d40f468
subpaths_valid = true
partial_subpaths = 0x562b8d40f110
pa_partial_subpaths = 0x562b8d40f168
pa_nonpartial_subpaths = 0x0
partial_subpaths_valid = true
pa_subpaths_valid = true
all_child_pathkeys = 0x0
all_child_outers = 0x562b8d40f1c0
l = 0x562b8d40f1d8
partial_rows = 500
#6 0x0000562b8c06f47b in set_append_rel_pathlist (root=0x562b8d3ebd00,
rel=0x562b8d3e8ec0,
rti=4, rte=0x562b8d3e7df0) at allpaths.c:1269
parentRTindex = 4
live_childrels = 0x562b8d40f060
l = 0x0
#7 0x0000562b8c06e33a in set_rel_pathlist (root=0x562b8d3ebd00,
rel=0x562b8d3e8ec0, rti=4,
rte=0x562b8d3e7df0) at allpaths.c:481
__func__ = "set_rel_pathlist"
#8 0x0000562b8c06e023 in set_base_rel_pathlists (root=0x562b8d3ebd00) at
allpaths.c:353
rel = 0x562b8d3e8ec0
rti = 4
#9 0x0000562b8c06dd72 in make_one_rel (root=0x562b8d3ebd00,
joinlist=0x562b8d40c8a8)
at allpaths.c:223
rel = 0x8d3ebd00
rti = 6
total_pages = 20
#10 0x0000562b8c0aab06 in query_planner (root=0x562b8d3ebd00,
qp_callback=0x562b8c0b07c1 <standard_qp_callback>, qp_extra=0x7fffd74e5cc0)
at planmain.c:276
parse = 0x562b8d3e72f0
joinlist = 0x562b8d40c8a8
final_rel = 0x562b8d3ed520
__func__ = "query_planner"
#11 0x0000562b8c0ad2bf in grouping_planner (root=0x562b8d3ebd00,
tuple_fraction=0)
at planner.c:1447
sort_input_targets = 0x562b8d3edec8
sort_input_target_parallel_safe = false
grouping_target = 0x562b8d3ebc70
scanjoin_target = 0x562b8d3edc40
activeWindows = 0x0
qp_extra = {activeWindows = 0x0, groupClause = 0x0}
sort_input_targets_contain_srfs = 0x0
have_grouping = false
wflists = 0x0
gset_data = 0x0
sort_input_target = 0x562b8d3edc98
grouping_targets = 0x562b8c017eee <bms_free+31>
grouping_target_parallel_safe = false
scanjoin_targets = 0x562b8d315790
scanjoin_target_parallel_safe = false
grouping_targets_contain_srfs = 0x7fffd74e5d00
scanjoin_targets_contain_srfs = 0x0
scanjoin_target_same_exprs = false
parse = 0x562b8d3e72f0
offset_est = 0
count_est = 0
limit_tuples = -1
have_postponed_srfs = false
final_target = 0x7fffd74e5e50
final_targets = 0x562b8d3ebd00
final_targets_contain_srfs = 0x0
final_target_parallel_safe = false
current_rel = 0x7fffd74e5e50
final_rel = 0x7fffd74e5d90
extra = {limit_needed = 32, limit_tuples = 4.681026602567763e-310,
count_est = 0,
offset_est = 0}
lc = 0x0
__func__ = "grouping_planner"
#12 0x0000562b8c0ac966 in subquery_planner (glob=0x562b8d3e91f0,
parse=0x562b8d3e72f0,
parent_root=0x0, hasRecursion=false, tuple_fraction=0) at planner.c:1025
root = 0x562b8d3ebd00
newWithCheckOptions = 0x0
newHaving = 0x0
hasOuterJoins = true
hasResultRTEs = false
final_rel = 0x93f900003457
l = 0x0
#13 0x0000562b8c0ab153 in standard_planner (parse=0x562b8d3e72f0,
query_string=0x562b8d3158b0 "select \n 1 as c0\nfrom \n\t(select
null::integer as c9, \n\t ref_0.a as c24\n\t from fkpart3_pk5 as
ref_0\n \t) as subq_0\n \tright join public.inet_tbl as sample_0 on
(cast(null as cidr) ="..., cursorOptions=2048, boundParams=0x0)
at planner.c:406
result = 0x562b8c3bf3ba <palloc+273>
glob = 0x562b8d3e91f0
tuple_fraction = 0
root = 0x562b8c038659 <lappend+141>
final_rel = 0x7fffd74e6070
best_path = 0x562b8d3ebca8
top_plan = 0x7fffd74e6100
lp = 0x562b8d3e8880
lr = 0x562b8c038170 <new_list+103>
#14 0x0000562b8c0aaf08 in planner (parse=0x562b8d3e72f0,
query_string=0x562b8d3158b0 "select \n 1 as c0\nfrom \n\t(select
null::integer as c9, \n\t ref_0.a as c24\n\t from fkpart3_pk5 as
ref_0\n \t) as subq_0\n \tright join public.inet_tbl as sample_0 on
(cast(null as cidr) ="..., cursorOptions=2048, boundParams=0x0)
at planner.c:277
result = 0x562b8d3e72f0
#15 0x0000562b8c1e5528 in pg_plan_query (querytree=0x562b8d3e72f0,
query_string=0x562b8d3158b0 "select \n 1 as c0\nfrom \n\t(select
null::integer as c9, \n\t ref_0.a as c24\n\t from fkpart3_pk5 as
ref_0\n \t) as subq_0\n \tright join public.inet_tbl as sample_0 on
(cast(null as cidr) ="..., cursorOptions=2048, boundParams=0x0)
at postgres.c:847
plan = 0xe88c1e5459
#16 0x0000562b8c1e5672 in pg_plan_queries (querytrees=0x562b8d3ebca8,
query_string=0x562b8d3158b0 "select \n 1 as c0\nfrom \n\t(select
null::integer as c9, \n\t ref_0.a as c24\n\t from fkpart3_pk5 as
ref_0\n \t) as subq_0\n \tright join public.inet_tbl as sample_0 on
(cast(null as cidr) ="..., cursorOptions=2048, boundParams=0x0)
at postgres.c:939
query = 0x562b8d3e72f0
stmt = 0x562b8d317548
query_list__state = {l = 0x562b8d3ebca8, i = 0}
stmt_list = 0x0
query_list = 0x562b8d3ebcc0
#17 0x0000562b8c1e59e4 in exec_simple_query (
query_string=0x562b8d3158b0 "select \n 1 as c0\nfrom \n\t(select
null::integer as c9, \n\t ref_0.a as c24\n\t from fkpart3_pk5 as
ref_0\n \t) as subq_0\n \tright join public.inet_tbl as sample_0 on
(cast(null as cidr) ="...) at postgres.c:1133
snapshot_set = true
per_parsetree_context = 0x0
plantree_list = 0x562b8bcd7000 <_start>
parsetree = 0x562b8d317548
commandTag = CMDTAG_SELECT
qc = {commandTag = 3612238320, nprocessed = 94745036175053}
querytree_list = 0x562b8d3ebca8
portal = 0x0
receiver = 0x562b8c39a5c7 <pg_any_to_server+88>
format = 0
parsetree_item__state = {l = 0x562b8d317580, i = 0}
dest = DestRemote
oldcontext = 0x562b8d3d6f40
parsetree_list = 0x562b8d317580
parsetree_item = 0x562b8d317598
save_log_statement_stats = false
was_logged = false
use_implicit_block = false
msec_str =
"\260X1\215+V\000\000\352\000\000\000\006\000\000\000\000bN\327\377\177\000\000PD\001\214\352\000\000"
__func__ = "exec_simple_query"
#18 0x0000562b8c1ea328 in PostgresMain (argc=1, argv=0x7fffd74e6440,
dbname=0x562b8d342420 "postgres", username=0x562b8d3423f8 "jcasanov") at
postgres.c:4486
query_string = 0x562b8d3158b0 "select \n 1 as c0\nfrom \n\t(select
null::integer as c9, \n\t ref_0.a as c24\n\t from fkpart3_pk5 as
ref_0\n \t) as subq_0\n \tright join public.inet_tbl as sample_0 on
(cast(null as cidr) ="...
firstchar = 81
input_message = {
data = 0x562b8d3158b0 "select \n 1 as c0\nfrom \n\t(select
null::integer as c9, \n\t ref_0.a as c24\n\t from fkpart3_pk5 as
ref_0\n \t) as subq_0\n \tright join public.inet_tbl as sample_0 on
(cast(null as cidr) ="..., len = 235, maxlen = 1024, cursor = 235}
local_sigjmp_buf = {{__jmpbuf = {0, 4442582095491262338,
94745029079040,
140736805627872, 0, 0, 4442582095537399682, 7930713879476856706},
__mask_was_saved = 1, __saved_mask = {__val = {4194304, 0, 0, 0, 0,
0, 0, 0, 0, 0,
1099511627520, 0, 0, 4294901760, 18446462598732840960, 0}}}}
send_ready_for_query = false
idle_in_transaction_timeout_enabled = false
idle_session_timeout_enabled = false
__func__ = "PostgresMain"
#19 0x0000562b8c11fc30 in BackendRun (port=0x562b8d33bd10) at postmaster.c:4521
av = {0x562b8c52f6ff "postgres", 0x0}
ac = 1
#20 0x0000562b8c11f55f in BackendStartup (port=0x562b8d33bd10) at
postmaster.c:4243
bn = 0x562b8d33ba60
pid = 0
__func__ = "BackendStartup"
#21 0x0000562b8c11b8b0 in ServerLoop () at postmaster.c:1765
port = 0x562b8d33bd10
i = 2
rmask = {fds_bits = {128, 0 <repeats 15 times>}}
selres = 1
now = 1631745784
readmask = {fds_bits = {224, 0 <repeats 15 times>}}
nSockets = 8
last_lockfile_recheck_time = 1631745754
last_touch_time = 1631745446
__func__ = "ServerLoop"
#22 0x0000562b8c11b0ff in PostmasterMain (argc=3, argv=0x562b8d30eec0) at
postmaster.c:1437
opt = -1
status = 0
userDoption = 0x562b8d3327d0 "data"
listen_addr_saved = true
i = 64
output_config_variable = 0x0
__func__ = "PostmasterMain"
#23 0x0000562b8c0176be in main (argc=3, argv=0x562b8d30eec0) at main.c:199
do_check_root = true