Files
threshold/internal/db/sqltest/tests/domain/immutable_table.sql
T
429247f407 [COMPLIANCE] Update Copyright Headers (#6282)
* [COMPLIANCE] Update Copyright and License Headers

* chore: make gen to generate files with copyright headers

* chore: update missed copyright headers

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: Justin Nguyen <justin.nguyen@hashicorp.com>
2026-01-28 11:05:07 -06:00

33 lines
785 B
PL/PgSQL

-- Copyright IBM Corp. 2020, 2025
-- SPDX-License-Identifier: BUSL-1.1
begin;
select plan(5);
create table test_t1 (
id text
);
insert into test_t1 (id) values ('one');
create trigger immutable_table before insert or update or delete
on test_t1 for each row execute procedure immutable_table();
select is(count(*), 1::bigint) from test_t1;
prepare insert_fail as insert into test_t1 (id) values ('two');
select throws_ok('insert_fail', '23603');
prepare update_fail as
update test_t1
set id = 'two'
where id = 'one';
select throws_ok('update_fail', '23603');
prepare delete_fail as delete from test_t1;
select throws_ok('delete_fail', '23603');
select is(count(*), 1::bigint) from test_t1;
select * from finish();
rollback;