Open def- opened 2 years ago
Which build did you use ? As of commit 042ad2c4c155f97356f80f8e14637195d207a91e, I don't see assertion in debug build:
yugabyte=# delete from public.single_row
yugabyte-# where
yugabyte-# case when EXISTS (
yugabyte(# select
yugabyte(# 95 as c0
yugabyte(# from
yugabyte(# public.client as ref_0
yugabyte(# where cast(null as point) <@ cast(null as line)) then case when (cast(null as tsquery) = case when false then cast(null as tsquery) else cast(null as tsquery) end
yugabyte(# )
yugabyte-# and (cast(null as timetz) < cast(null as timetz)) then (select col_double from public.table_create_org limit 1 offset 3)
yugabyte-# else (select col_double from public.table_create_org limit 1 offset 3)
yugabyte-# end
yugabyte-# else case when (cast(null as tsquery) = case when false then cast(null as tsquery) else cast(null as tsquery) end
yugabyte(# )
yugabyte-# and (cast(null as timetz) < cast(null as timetz)) then (select col_double from public.table_create_org limit 1 offset 3)
yugabyte-# else (select col_double from public.table_create_org limit 1 offset 3)
yugabyte-# end
yugabyte-# end
yugabyte-# >= cast(coalesce(pg_catalog.pg_stat_get_checkpoint_write_time(),
yugabyte(# (select col_double from public.table_create_ctas_nodata limit 1 offset 2)
yugabyte(# ) as float8)
yugabyte-# returning
yugabyte-# public.single_row.v2 as c0,
yugabyte-# public.single_row.k as c1,
yugabyte-# public.single_row.v2 as c2,
yugabyte-# public.single_row.v2 as c3;
c0 | c1 | c2 | c3
----+----+----+----
(0 rows)
DELETE 0
Build is bd9950ebe8fb8e6bb551149c61520446f6d8ccd0. I guess these triggers are also important, especially since it fails in trigger.c:
COPY public.single_row (k, v1, v2) FROM stdin;
1 2 1
\.
ALTER TABLE ONLY public.single_row
ADD CONSTRAINT single_row_pkey PRIMARY KEY (k);
CREATE TRIGGER single_row_delete_trigger BEFORE DELETE ON public.single_row FOR EACH ROW EXECUTE PROCEDURE suppress_redundant_updates_trigger();
CREATE TRIGGER single_row_update_trigger BEFORE UPDATE ON public.single_row FOR EACH ROW EXECUTE PROCEDURE suppress_redundant_updates_trigger();
The inserted data also mattered, added it now, can reproduce locally on a clean DB.
With one row in the table:
yugabyte=# select * from single_row;
k | v1 | v2
---+----+----
1 | 2 | 1
(1 row)
I added two triggers and populated table_create_org table. There is crash in debug build for the DELETE statement.
Just to make sure, but with the full command including the COPY public.table_create_org
you can reproduce it?
pg_catalog.pg_stat_get_checkpoint_write_time()
The above is not relevant to YB. Can you trim the query a little bit by dropping non-YB constructs ?
If these constructs cause crashes, then we should disable them. I'd have to change SQLsmith to exclude pg_* functions, but this seems like we'd just hide the existing problems. (Haven't checked if it's actually related to this functino)
Without accessing catalog, the following query crashes:
delete from public.single_row
where
case when EXISTS (
select
95 as c0
from
public.client as ref_0
where cast(null as point) <@ cast(null as line)) then case when (cast(null as tsquery) = case when false then cast(null as tsquery) else cast(null as tsquery) end
)
and (cast(null as timetz) < cast(null as timetz)) then (select col_double from public.table_create_org limit 1 offset 3)
else (select col_double from public.table_create_org limit 1 offset 3)
end
else case when (cast(null as tsquery) = case when false then cast(null as tsquery) else cast(null as tsquery) end
)
and (cast(null as timetz) < cast(null as timetz)) then (select col_double from public.table_create_org limit 1 offset 3)
else (select col_double from public.table_create_org limit 1 offset 3)
end
end
>= cast(coalesce(0,
(select col_double from public.table_create_ctas_nodata limit 1 offset 2)
) as float8)
returning
public.single_row.v2 as c0,
public.single_row.k as c1,
public.single_row.v2 as c2,
public.single_row.v2 as c3;
I suggest changing the title of this issue to:
Delete statement involving triggers fails assertion in debug build for invalid tupleid
Jira Link: DB-1028
Description
SQLsmith found this, the null pointer looks like it will cause problems later on. Can be reproduced:
Failure in tserver logs: