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?.
1 rows affected
1 rows affected
1 rows affected
ERROR: new row for relation "box" violates check constraint "exactly_one_from"
DETAIL: Failing row contains (1, foo, null, null, null).
1 rows affected
1 rows affected
ERROR: new row for relation "box" violates check constraint "exactly_one_from"
DETAIL: Failing row contains (4, foo, 1, null, 3).
box_id | box_content | from_user | from_office | from_import |
---|---|---|---|---|
2 | foo | 1 | null | null |
3 | foo | null | 2 | null |
box_id | box_content | from_id | from_type |
---|---|---|---|
2 | foo | 1 | user |
3 | foo | 2 | office |