By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
| version |
|---|
| PostgreSQL 14.5 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-10), 64-bit |
SELECT 1
CREATE TABLE
CREATE FUNCTION
CREATE TRIGGER
INSERT 0 1
INSERT 0 1
INSERT 0 1
ERROR: Bank 1, Mortage 2 already has non-draft status CONTEXT: PL/pgSQL function just_1_non_draft() line 9 at RAISE
INSERT 0 1
| bank | mortage | status |
|---|---|---|
| 1 | 2 | draft |
| 1 | 2 | draft |
| 1 | 2 | active |
| 3 | 2 | active |
SELECT 4