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?.
version |
---|
PostgreSQL 12.4 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5), 64-bit |
3 rows affected
1 rows affected
1 rows affected
1 rows affected
1 rows affected
id | name | description | profile_pic | is_private | is_group | pus_code | created_at | updated_at |
---|---|---|---|---|---|---|---|---|
1 | Standard 1 | Neither private nor group | null | f | f | null | 2020-08-30 23:04:19.492607+01 | null |
2 | Private 1 | A private chat | null | t | f | null | 2020-08-30 23:04:19.492607+01 | null |
3 | Group 1 | A group chat | null | f | t | A | 2020-08-30 23:04:19.492607+01 | null |
4 | Private Group 1 | Strange but notg Invalid | null | t | t | B | 2020-08-30 23:04:19.492607+01 | null |
id | name | description | profile_pic | is_private | pus_code | created_at | updated_at |
---|---|---|---|---|---|---|---|
3 | Group 1 | A group chat | null | f | A | 2020-08-30 23:04:19.492607+01 | null |
4 | Private Group 1 | Strange but notg Invalid | null | t | B | 2020-08-30 23:04:19.492607+01 | null |
id | name | description | profile_pic | is_group | pus_code | created_at | updated_at |
---|---|---|---|---|---|---|---|
2 | Private 1 | A private chat | null | f | null | 2020-08-30 23:04:19.492607+01 | null |
4 | Private Group 1 | Strange but notg Invalid | null | t | B | 2020-08-30 23:04:19.492607+01 | null |
ERROR: insert or update on table "chat_room" violates foreign key constraint "fk__group_chat_room__puskesmas"
DETAIL: Key (pus_code)=(X) is not present in table "puskesmas".
ERROR: new row for relation "chat_room" violates check constraint "not_group_of_pus_code_check"
DETAIL: Failing row contains (6, Invalid group 2, Missing pus_code, null, f, t, null, 2020-08-30 23:04:19.495784+01, null).
ERROR: new row for relation "chat_room" violates check constraint "not_group_of_pus_code_check"
DETAIL: Failing row contains (7, Invalid group 3, pus_code but not is_group, null, f, f, C, 2020-08-30 23:04:19.49601+01, null).
ERROR: duplicate key value violates unique constraint "group_chat_room_pus_code_uindex"
DETAIL: Key (pus_code)=(A) already exists.