You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When issuing an UPDATE against a compressed hypertable that includes a self-join, the error:
ERROR: XX000: chunk not found
LOCATION: chunk_scan_find, chunk.c:1585
is raised. This even occurs when not actually executing the query, but only planning the query.
To Reproduce
CREATETABLEbugtable (
inserted timestamptznot null default now(),
value double precision
);
SELECT create_hypertable(
'bugtable',
'inserted',
chunk_time_interval => interval '1 minute'
);
-- Some dummy dataINSERT INTO
bugtable
SELECT
now() - random() * interval '10 minutes'FROM
generate_series(1,100);
ALTERTABLE bugtable SET (
timescaledb.compress
);
SELECT add_compress_chunks_policy(
'bugtable',
INTERVAL '1' MINUTE
);
-- ERROR: XX000: chunk not found-- LOCATION: chunk_scan_find, chunk.c:1585---- This problem already occurs when running `EXPLAIN (ANALYZE OFF)` on the queryUPDATE
bugtable
SET
value =NULLWHERE
inserted = (
SELECTmax(inserted)
FROM
bugtable
WHERE
inserted > now() - interval '10 seconds'
)
AND inserted > now() - interval '10 seconds';
-- Different type of query, but same result-- ERROR: XX000: chunk not found-- LOCATION: chunk_scan_find, chunk.c:1585
WITH my_cte(max) AS (
SELECTmax(inserted)
FROM
bugtable
WHERE
inserted > now() - interval '10 seconds'
)
UPDATE
bugtable
SET
value =NULLFROM
my_cte
WHERE
inserted = max;
-- However, when splitting up the queries and using an intermediate variable, the query runs fine
DO $$
DECLARE
max timestamptz;
count bigint;
BEGINSELECTmax(inserted)
INTO
max
FROM
bugtable
WHERE
inserted < now() - interval '10 minutes';
UPDATE
bugtable
SET
value =NULLWHERE
inserted = MAX
AND inserted < now() - interval '10 minutes';
GET DIAGNOSTICS count = ROW_COUNT;
RAISE NOTICE 'Updated % rows', count;
END;
$$;
Relevant system information:
Describe the bug
When issuing an UPDATE against a compressed hypertable that includes a self-join, the error:
is raised. This even occurs when not actually executing the query, but only planning the query.
To Reproduce
Expected behavior
An update of 0 or 1 rows
Actual behavior
ERROR: XX000: chunk not found
Source of the report
This bug was reported here https://timescaledb.slack.com/archives/C63MYDZ35/p1574933617190200
The text was updated successfully, but these errors were encountered: