dolthub / dolthub/doltgresql

Update does not work when setting generated column to default

Open
#3,204 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.1k
Forks
73
Avg merge
1d 11h
Merged PRs (30d)
152

Description

The following query works in Postgres but errors out in Doltgres
```
postgres=# create table t1 (i int primary key, j int generated always as (i + 10) stored);
CREATE TABLE

postgres=# insert into t1 (i, j) values (1, default);
INSERT 0 1
postgres=# select * from t1;
i | j
---+----
1 | 11
(1 row)

postgres=# update t1 set j = default where i = 1;
UPDATE 1
```

Doltgres error: `ERROR: UPDATE: non-Doltgres type found in source: () (SQLSTATE XX000)`

Test case skipped and tagged with issue link in https://github.com/dolthub/go-mysql-server/pull/3705

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the PostgreSQL query in Doltgres, then inspect the skipped test case and issue link in go-mysql-server PR 3705. Done means updating a generated column with DEFAULT succeeds and the regression test is enabled and passes.

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.