var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Pl/pgsql trigger returning values??
Am ewbie to postgres...could appreciate some help..
I created the following function and trigger that simply breaks a date down into the day, month, year:
CREATE FUNCTION pg_fct_person_insert4 () RETURNS TRIGGER AS '
NEW.GEBTT := TO_CHAR(NEW.GEBDAT, ''DD'');
NEW.GEBMM := TO_CHAR(NEW.GEBDAT, ''MM'');
NEW.GEBJJJJ := TO_CHAR(NEW.GEBDAT, ''YYYY'');
' LANGUAGE 'plpgsql';
create trigger trigperson before insert on tbl0100person
for each row execute procedure pg_fct_person_insert4();
but I receive the following error:
WARNING: at END of toplevel PL block
ERROR: control reaches end of trigger procedure without RETURN
How so, if I do return the NEW??
Thanks a ton
you don't seem to be passing the function a value?
I don´t pass any value because there is no need for this. i have looked in all the examples in the book "Practival postrgresql" and the structure seems to be the same as mine, with the diference that they work and mine does not.
In chapter 11:
'A trigger function should be defined as accepting no arguments, and returns a value of the special opaque data type..'
Got any clues?
Got the problem resolved...I had an old trigger defined with another function as well. So my current trigger and function is ok, the error was related to an old trigger also running on the table.
Thanks just the same!