postgres update parent if entity / foreign key updates I have a table recipes and every recipe can have multiple entries.

CREATE TABLE IF NOT EXISTS "recipes" (
    "ident" SERIAL PRIMARY KEY,
    "identifier" TEXT NOT NULL UNIQUE,
    "modified_on" TIMESTAMP WITH TIME ZONE DEFAULT NULL
);

CREATE TABLE IF NOT EXISTS "entries" (
    "ident" SERIAL PRIMARY KEY,
    "recipe_id" INTEGER NOT NULL,
    "name" TEXT
    FOREIGN KEY ("recipe_id") REFERENCES "recipes"("ident") ON DELETE CASCADE
);


Now when a recipe is updated, the following function is called and updates my timestamp:

CREATE OR REPLACE FUNCTION update_recipe_timestamp_proc()
RETURNS TRIGGER AS $$
BEGIN
    NEW."modified_on" = now();
    PERFORM pg_notify('notify_recipes_update', CAST(NEW.ident AS text));
    RETURN NEW;   
END;
$$ language 'plpgsql';


Now I also want my timestamp in the recipe modified_on to get updated whenever an entry which belongs to it is updated.

The following trigger is not working.

DROP TRIGGER IF EXISTS update_recipes_timestamp_e ON entries;
CREATE TRIGGER update_recipes_timestamp_e BEFORE UPDATE ON entries FOR EACH ROW EXECUTE PROCEDURE update_recipe_timestamp_proc();


ERROR: Record "NEW" has no field "modified_on"

Someone can give me a hint what I have to do?
Here is my solution.

CREATE OR REPLACE FUNCTION update_recipe_timestamp_from_entry_proc()
RETURNS TRIGGER AS $$
BEGIN
    UPDATE recipes SET modified_on = now() WHERE ident = NEW."recipe_id";
    PERFORM pg_notify('notify_recipe_update', CAST(NEW."recipe_id" AS text));
    RETURN NEW;   
END;
$$ language 'plpgsql';

DROP TRIGGER IF EXISTS update_recipes_timestamp_e ON entries;
CREATE TRIGGER update_recipes_timestamp_e BEFORE UPDATE ON entries FOR EACH ROW EXECUTE PROCEDURE update_recipe_timestamp_from_entry_proc();