diff options
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/insert.out | 21 | ||||
| -rw-r--r-- | src/test/regress/sql/insert.sql | 21 |
2 files changed, 37 insertions, 5 deletions
diff --git a/src/test/regress/expected/insert.out b/src/test/regress/expected/insert.out index 7fafa982126..6f34b1c6406 100644 --- a/src/test/regress/expected/insert.out +++ b/src/test/regress/expected/insert.out @@ -354,11 +354,26 @@ ERROR: no partition of relation "mlparted1" found for row DETAIL: Partition key of the failing row contains ((b + 0)) = (5). truncate mlparted; alter table mlparted add constraint check_b check (b = 3); --- check that correct input row is shown when constraint check_b fails on mlparted11 --- after "(1, 2)" is routed to it +-- have a BR trigger modify the row such that the check_b is violated +create function mlparted11_trig_fn() +returns trigger AS +$$ +begin + NEW.b := 4; + return NEW; +end; +$$ +language plpgsql; +create trigger mlparted11_trig before insert ON mlparted11 + for each row execute procedure mlparted11_trig_fn(); +-- check that the correct row is shown when constraint check_b fails after +-- "(1, 2)" is routed to mlparted11 (actually "(1, 4)" would be shown due +-- to the BR trigger mlparted11_trig_fn) insert into mlparted values (1, 2); ERROR: new row for relation "mlparted11" violates check constraint "check_b" -DETAIL: Failing row contains (1, 2). +DETAIL: Failing row contains (1, 4). +drop trigger mlparted11_trig on mlparted11; +drop function mlparted11_trig_fn(); -- check that inserting into an internal partition successfully results in -- checking its partition constraint before inserting into the leaf partition -- selected by tuple-routing diff --git a/src/test/regress/sql/insert.sql b/src/test/regress/sql/insert.sql index f9c00705a22..020854c960e 100644 --- a/src/test/regress/sql/insert.sql +++ b/src/test/regress/sql/insert.sql @@ -217,9 +217,26 @@ insert into mlparted (a, b) values (1, 5); truncate mlparted; alter table mlparted add constraint check_b check (b = 3); --- check that correct input row is shown when constraint check_b fails on mlparted11 --- after "(1, 2)" is routed to it + +-- have a BR trigger modify the row such that the check_b is violated +create function mlparted11_trig_fn() +returns trigger AS +$$ +begin + NEW.b := 4; + return NEW; +end; +$$ +language plpgsql; +create trigger mlparted11_trig before insert ON mlparted11 + for each row execute procedure mlparted11_trig_fn(); + +-- check that the correct row is shown when constraint check_b fails after +-- "(1, 2)" is routed to mlparted11 (actually "(1, 4)" would be shown due +-- to the BR trigger mlparted11_trig_fn) insert into mlparted values (1, 2); +drop trigger mlparted11_trig on mlparted11; +drop function mlparted11_trig_fn(); -- check that inserting into an internal partition successfully results in -- checking its partition constraint before inserting into the leaf partition |
