By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
| 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 |
2 rows affected
| user_id | user_name |
|---|---|
| 1 | user_1 |
| 2 | user_2 |
4 rows affected
| message_id | sender_id | message_text |
|---|---|---|
| 1 | 1 | m1 |
| 2 | 1 | m2 |
| 3 | 2 | m3 |
| 4 | 2 | m4 |
ERROR: insert or update on table "message" violates foreign key constraint "message_sender_id_fkey"
DETAIL: Key (sender_id)=(56) is not present in table "user_".