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
id |
---|
1 |
2 |
INSERT 0 2
CREATE TABLE
id | userid | misc |
---|---|---|
1 | 1 | a |
2 | 1 | b |
3 | 1 | c |
INSERT 0 3
CREATE TABLE
INSERT 0 1
id | userid | misc | isactive |
---|---|---|---|
1 | 1 | a | f |
2 | 1 | b | f |
3 | 1 | c | t |
SELECT 3
ERROR: duplicate key value violates unique constraint "true_row_fk_userid_key" DETAIL: Key (fk_userid)=(1) already exists.
INSERT 0 1