Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

UPDATE in CTE incorrectly errors out #8693

Copy link
Copy link

Description

@colm-mchugh
Issue body actions

An UPDATE on a distributed table with an equality on the distribution column and an AND FALSE predicate that is wrapped in a CTE that is used in an outer select errors out;
Here is a repro; the query should return 0 rows, but hits an error

CREATE TABLE citus_cte_repro (dist_key bigint NOT NULL, val int);
SELECT create_distributed_table('citus_cte_repro', 'dist_key');
INSERT INTO citus_cte_repro SELECT g, g FROM generate_series(1, 20) g;

WITH u AS (
  UPDATE citus_cte_repro SET val = val
  WHERE dist_key = 7 AND false
  RETURNING dist_key
)
SELECT count(*) FROM u;   

ERROR: could not find valid entry for shard 0

This issue is present in Citus 12.1, so not a recent regression.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.