dolthub / dolthub/doltgresql

UPDATE metadata semantics incorrect

Open
#3,113 1 comment 0 reactions 0 assignees View on GitHub
customer issue
Dominant language
Go
Stars
2.1k
Forks
73
Avg merge
1d 10h
Merged PRs (30d)
129

Description

The Postgres response for an `UPDATE` reports how many rows matched the WHERE clause, regardless of whether the value changed. This differs from the MySQL semantics (reports rows changed), but is equivalent to setting the `CLIENT_FOUND_ROWS` client compatibility flag.

This bug is critical due to its interpretation by ORMs, where a 0 result is used as proof of absence from a table.

```sql
CREATE TABLE bug3 (id integer PRIMARY KEY, v text);
INSERT INTO bug3 VALUES (1, 'same');

UPDATE bug3 SET v = 'same' WHERE id = 1; -- reports 0; PostgreSQL reports 1
UPDATE bug3 SET v = 'different' WHERE id = 1; -- reports 1
UPDATE bug3 SET v = 'x' WHERE id = 999; -- reports 0
```

Contributor guide

Open the contributing guide

Research direction

Start by running the SQL reproduction in the issue and tracing the UPDATE result-count handling in the Go code. Verify the behavior for unchanged values, changed values, and unmatched rows; done means the reported count follows PostgreSQL semantics in all three cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgresql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.