By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
CREATE TABLE
CREATE TABLE
INSERT 0 2
INSERT 0 3
id | user_id | content | name |
---|---|---|---|
1 | 1 | Alice Note 1 | Alice |
2 | 1 | Alice Note 2 | Alice |
3 | 2 | Bob Note | Bob |
SELECT 3
BEGIN
ERROR: update or delete on table "users" violates foreign key constraint "fk_user" on table "notes" DETAIL: Key (id)=(1) is still referenced from table "notes".