By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
select version();
version |
---|
PostgreSQL 12.17 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-20), 64-bit |
SELECT 1
create or replace function no_no_no()
returns trigger
language plpgsql
as $$
begin
raise exception 'Cannot update table %s.', tg_table_name;
return null;
end;
$$;
CREATE FUNCTION
create table NYAidCrimeMean( id integer generated always as identity
, code text
);
insert into NYAidCrimeMean (code)
select chr(ascii('A')+ n)
from generate_series (0,25) gs(n) ;
CREATE TABLE
INSERT 0 26
create trigger No_no_no_NYAidCrimeMeanA
before insert or update or delete or truncate on NYAidCrimeMean
for each statement
execute function no_no_no();
CREATE TRIGGER
update NYAidCrimeMean
set code = code || ' 10-40';
ERROR: Cannot update table nyaidcrimemeans. CONTEXT: PL/pgSQL function no_no_no() line 3 at RAISE