citusdata / citusdata/citus

INSERT … SELECT does not error out in append/range distributed tables if SELECTed table is same with INSERTed one

Open
#1,625 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C
Stars
12.8k
Forks
794
Avg merge
2d 14h
Merged PRs (30d)
31

Description

We should error out saying “INSERT ... SELECT into an append-distributed table is not supported” as we do for append distributed tables

This happens because according to our definition of colocation, all tables are colocated with itself (even append distributed ones). Thus, below code passes related error checks.

Example test case to reproduce the issue;
```sql
CREATE TABLE append_copy(id integer, data text, int_data int);
SELECT create_distributed_table('append_copy', 'id', 'append');
COPY append_copy FROM PROGRAM 'echo 0, a, 0\\n1, b, 1\\n2, c, 2\\n3, d, 3\\n4, e, 4' WITH CSV;

INSERT INTO append_copy SELECT * FROM append_copy;
INSERT 0 0
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.