Skip to content

sql: ON DELETE SET DEFAULT violates constraints #23361

@knz

Description

@knz

Found while investigating #22304.

 create table base (x int primary key);
 create table derived(x int primary key, y int default 123 references base(x) on delete set default);
 insert into base values(456);
 insert into derived values (111, 456);

 --- bang:
 delete from base where true;

Expected, pg has this correct:

pq: foreign key violation: value [123] not found in base@primary [x]

in CockroachDB, currently, incorrect: no error.

cc @BramGruneir.

I have a patch incoming.

Metadata

Metadata

Assignees

Labels

C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions