So here is my problem,
I have a procedure with :
DECLARE
serialvar INTEGER;
BEGIN
serialvar := NEW.battery_serial;
CREATE OR REPLACE VIEW battery_vue
AS
SELECT * FROM cells WHERE battery_serial = serialvar;
RETURN NEW;
END;
but when the trigger of that procedure is activated i have an error saying :
ERROR: the column « serialvar » does not exist
LINE 3: SELECT * FROM cells WHERE battery_serial = serialVar
You have to pass the value into a dynamic SQL like
this way you take the new value, and if it is 1 (for example), then
battery_vuewill show you only thecellswherebattery_serial = 1. Is this what you want? (The next insert or whatever will recreate the view, possibly with a differentbattery_serial.)