citusdata / citusdata/citus

Number of rows for insert..select..on conflict via coordinator is incorrect

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

Description

When doing an INSERT..SELECT .. ON CONFLICT DO NOTHING via the coordinator, the number of rows reported in the completion tag is incorrect. It should indicate the number of rows that were modified, which in the below example is 0.

```sql
postgres=# CREATE TABLE t (x int primary key);
CREATE TABLE
postgres=# INSERT INTO t SELECT s FROM generate_series(1,10) s ON CONFLICT DO NOTHING;
INSERT 0 10
postgres=# INSERT INTO t SELECT s FROM generate_series(1,10) s ON CONFLICT DO NOTHING;
INSERT 0 0
postgres=# SELECT create_distributed_table('t','x');
NOTICE: Copying data from local table...
┌──────────────────────────┐
│ create_distributed_table │
├──────────────────────────┤
│ │
└──────────────────────────┘
(1 row)

postgres=# INSERT INTO t SELECT s FROM generate_series(1,10) s ON CONFLICT DO NOTHING;
INSERT 0 10
```

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.