ALTER TABLE tetel_raktar_egyedi ADD COLUMN letrejott timestamp without time zone;
ALTER TABLE tetel_raktar_egyedi ALTER COLUMN letrejott SET DEFAULT now();

ALTER TABLE tetel_raktar_egyedi ADD COLUMN modosult timestamp without time zone;
ALTER TABLE tetel_raktar_egyedi ALTER COLUMN modosult SET DEFAULT now();

CREATE OR REPLACE FUNCTION tr_tetel_raktar_egyedi()
  RETURNS trigger AS
$BODY$
begin
  new.modosult := (SELECT now());
  return new;
end;$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

CREATE TRIGGER trigger_tetel_raktar_egyedi
  BEFORE UPDATE
  ON tetel_raktar_egyedi
  FOR EACH ROW
  EXECUTE PROCEDURE tr_tetel_raktar_egyedi();
