Skip to content

Instantly share code, notes, and snippets.

@kmoppel
Last active June 13, 2016 14:29
Show Gist options
  • Save kmoppel/f8560495f387ae5394e9e523c854fe87 to your computer and use it in GitHub Desktop.
Save kmoppel/f8560495f387ae5394e9e523c854fe87 to your computer and use it in GitHub Desktop.
Creates a simple table and attaches a trigger function that just sleeps 1s
create table t1(c1 int);
CREATE OR REPLACE FUNCTION public.t1_upd()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
begin
perform pg_sleep(1);
return new;
end;
$function$;
create trigger t1_upd_trg after update or insert on t1 for each row execute procedure t1_upd();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment