`SET CONSTRAINTS` fails with an internal error
- Dominant language
- Go
- Stars
- 2.1k
- Forks
- 73
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 129
Description
On Doltgres 1.3.2, `SET CONSTRAINTS` fails for both `IMMEDIATE` and `DEFERRED` modes.
### Repro
```sql
BEGIN;
SET CONSTRAINTS ALL IMMEDIATE;
ROLLBACK;
BEGIN;
SET CONSTRAINTS ALL DEFERRED;
ROLLBACK;
```
Both commands produce:
```text
ERROR: unknown statement type encountered: `*tree.SetConstraints`
SQLSTATE: XX000
```
Named constraints fail the same way:
```sql
CREATE TABLE parent_example (
id integer PRIMARY KEY
);
CREATE TABLE child_example (
id integer PRIMARY KEY,
parent_id integer CONSTRAINT child_parent_fk
REFERENCES parent_example(id)
DEFERRABLE INITIALLY DEFERRED
);
BEGIN;
SET CONSTRAINTS child_parent_fk IMMEDIATE;
ROLLBACK;
```
Contributor guide
Research direction
Start by running the supplied BEGIN, SET CONSTRAINTS, and ROLLBACK repros, then trace handling of the `SET CONSTRAINTS` statement and the `tree.SetConstraints` type. Done means both ALL and named constraints work in IMMEDIATE and DEFERRED modes without the internal error.
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
- 68/100