Skip to content

Materialization of decompressed tuples using "CREATE TABLE AS" causes memory corruption Β #10585

Closed

Description

@antekresic

Looks like handling of decompressed text columns (most likely dictionary compression) can produce corrupt materialized tuples. No issues with simple SELECT but when combined with CTAS, we get data corruption.

CREATE TABLE repro_src(ts timestamptz NOT NULL, txt text, seg text);
SELECT create_hypertable('repro_src', by_range('ts'));
ALTER TABLE repro_src SET (timescaledb.compress,
                             timescaledb.compress_segmentby = 'seg',
                             timescaledb.compress_orderby = 'ts');
INSERT INTO repro_src VALUES
    ('2024-01-01 00:00:01+00', 'a',        'segvalue'),
    ('2024-01-01 00:00:02+00', 'abcdefgh', 'segvalue');
SELECT compress_chunk(c) FROM show_chunks('repro_src') c;

SELECT txt, seg FROM repro_src ORDER BY ts;   -- both rows: segvalue
CREATE TEMP TABLE dst AS SELECT * FROM repro_src;
SELECT txt, seg FROM dst ORDER BY ts;         -- row 2 seg: fghsegvalue~\x7F\x7F...

Activity

  1. added this to the v2.30.1 milestone on Sep 11, 2026
  2. added theissue type on Sep 11, 2026
  3. changed the title [-]Materialization of decompressed tuples causes memory corruption[/-] [+]Materialization of decompressed tuples using CTAS causes memory corruption [/+] on Sep 11, 2026
  4. self-assigned this
    on Sep 11, 2026
  5. changed the title [-]Materialization of decompressed tuples using CTAS causes memory corruption [/-] [+]Materialization of decompressed tuples using "CREATE TABLE AS" causes memory corruption [/+] on Sep 11, 2026
  6. modified the milestones: v2.30.1, v2.30.2 on Sep 17, 2026
  7. dbeck commented on Sep 28, 2026

    @dbeck
    Member

    @akuzm : I have a fix for this, happy to send it for PR unless you already started working on it

  8. akuzm commented on Sep 28, 2026

    @akuzm
    Member

    @akuzm : I have a fix for this, happy to send it for PR unless you already started working on it

    @dbeck I have this thing: #10657 I wanted to add some tests and publish it for review.

  9. added a commit that references this issue on Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions