Creating & executing the following trigger function in PgAdmin of Postgres database will concatenate the attributes of any class.
CREATE OR REPLACE FUNCTION Test()
RETURNS TRIGGER
AS $$
BEGIN
NEW.“Description” = left(concat_ws(’ - ', NEW.“Code”, NEW.“Name”), 250);
RETURN NEW;
END;
$$ language ‘plpgsql’;
CREATE TRIGGER Testtrigger
BEFORE INSERT OR UPDATE ON “ClassName”
FOR EACH ROW
EXECUTE PROCEDURE Test();
If the above trigger needs to removed, then below query can be executed.
DROP TRIGGER Testtrigger on “ClassName”