I'm trying to create a trigger via pgadmin in order to have a calculated column.
I need to do: c = a / b
I created a function UpdateC, which contains the following code:
UPDATE table_name
SET c = a / b
WHERE id = @id
and I declared @id as a parameter.
Then I thought I would create a trigger and would link it to that function, but I found out that I need to link it to a trigger function rather than to a function.
Now I'm trying to create a trigger function with the exact same SQL as above, but I'm getting the next error:
syntax error at or near "UPDATE"
Under definition tab I had to choose a language, so I chose "plpgsql" (The other options are "c" and "internal").
Any help will be profoundly appreciated!