i cant seem to logically place this error being produced unlike most gives little to no information as to why (usually seems theirs very good pre-processors or you can dig into the logic, yet here i get no error. also i have another function working well, that adds those keys, so its not that.. other then the transaction seems to fail and i get in the terminal when i enter
update guest_list set coatcheck = true where ticket_number = 3;
"PL/pgSQL function coatcheck_gen() line 8 at SQL statement SQL statement "update guest_list set coatcheck_num = coat_num where ticket_number = old.ticket_number" PL/pgSQL function coatcheck_gen() line 8 at SQL statement SQL statement "update guest_list set coatcheck_num = coat_num where ticket_number = old.ticket_number"
this goes on for pages, then ends. i've tried uses new. old. or just numbers to see. and nothing. same error. all of the tables are fine. all updates work when just done on command. it appears in examples elsewhere seemly correct...
the function is
create or replace function coatcheck_gen() returns trigger as $gencoatcheck$
declare
coat_num bigint;
begin
IF (TG_OP = 'UPDATE') then
if ( new.coatcheck = true ) then
coat_num := (old.frkey_id_event + old.frkey_id_guest);
update guest_list set coatcheck_num = coat_num where ticket_number = old.ticket_number;
return new;
END IF;
return new;
end if;
return new;
end;
$gencoatcheck$ LANGUAGE plpgsql;
trigger
create trigger trg_coatchek_gen after update on guest_list for each row when (new.coatcheck = true) execute Procedure coatcheck_gen();
trigger after update for each rowand inside trigger you update the same table. Is it your real intention? If it was your idea than what's went wrong? You have an exception in your transaction? You have an exception for each row or you have no exception and it looks wrong for you?