Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: EXPLAIN for UPDATE of compressed hypertable fails #6175

Closed
svenklemm opened this issue Oct 8, 2023 · 2 comments · Fixed by #6210
Closed

[Bug]: EXPLAIN for UPDATE of compressed hypertable fails #6175

svenklemm opened this issue Oct 8, 2023 · 2 comments · Fixed by #6210

Comments

@svenklemm
Copy link
Member

svenklemm commented Oct 8, 2023

EXPLAIN of UPDATE of compressed hypertable fails with bogus varno

BEGIN; EXPLAIN (analyze,costs off,timing off,summary off) UPDATE decompress_tracking SET value = value + 3 WHERE device = 'd1'; ROLLBACK;
BEGIN
Time: 1.739 ms
ERROR:  XX000: bogus varno: -3
LOCATION:  resolve_special_varno, ruleutils.c:7619

To reproduce:

CREATE TABLE decompress_tracking(time timestamptz not null, device text, value float);
SELECT table_name FROM create_hypertable('decompress_tracking','time');
ALTER TABLE decompress_tracking SET (timescaledb.compress, timescaledb.compress_segmentby='device');

INSERT INTO decompress_tracking SELECT '2020-01-01', 'd1', random() FROM generate_series(1,10);
INSERT INTO decompress_tracking SELECT '2020-01-01', 'd2', random() FROM generate_series(1,20);
INSERT INTO decompress_tracking SELECT '2020-01-01', 'd3', random() FROM generate_series(1,30);

SELECT count(compress_chunk(ch)) FROM show_chunks('decompress_tracking') ch;

BEGIN; UPDATE decompress_tracking SET value = value + 3 WHERE device = 'd1'; ROLLBACK; -- (or commit, doesn't make a difference)
BEGIN; EXPLAIN (analyze,costs off,timing off,summary off) UPDATE decompress_tracking SET value = value + 3 WHERE device = 'd1'; ROLLBACK;

@konskov
Copy link
Contributor

konskov commented Oct 9, 2023

it seems this was introduced by #5586

@konskov
Copy link
Contributor

konskov commented Oct 16, 2023

In the case of the explain plan, I think the issue is the fact that the plan we get from ExecInitNode/decompress_chunk_walker is a seqscan. Thus, in set_deparse_plan, dpns->index_tlist is set to NULL, but later in resolve_special_varno, we have var->varno == INDEX_VAR (because we have set it so in fix_index_qual) and yet dpns->index_tlist is NULL.
These observations make me think the issue is limited to the EXPLAIN, but given SDC#1350 https://github.com/timescale/Support-Dev-Collab/issues/1350, I am not so sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants