By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
| version |
|---|
| PostgreSQL 12.14 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-16), 64-bit |
SELECT 1
CREATE TABLE
INSERT 0 2
| id | val | note |
|---|---|---|
| 1 | 1234 | Short, but I'm here before the 6 character minimun |
| 2 | 1234567 | I would always be OK |
SELECT 2
CREATE FUNCTION
CREATE TRIGGER
CREATE TRIGGER
INSERT 0 1
ERROR: Cannot INSERT val = '123'. Must have at least 6 characters. CONTEXT: PL/pgSQL function trg_col_min_len6() line 3 at RAISE
UPDATE 1
| id | val | note |
|---|---|---|
| 2 | 1234567 | I would always be OK |
| 3 | 123456789 | OK, I'm good! Yea me. |
| 1 | 1234 | Short, but still OK. I was here before the 6 character minimun |
SELECT 3
ERROR: Cannot UPDATE val = '12345'. Must have at least 6 characters. CONTEXT: PL/pgSQL function trg_col_min_len6() line 3 at RAISE
ERROR: null value in column "val" violates not-null constraint DETAIL: Failing row contains (1, null, How about all the wat to nothing?? ).