Make one column depend on another

0

I need that when inserting a row, one data is updated in function of another. In this case I intend that number2 be updated to be the same as number1, but the trigger does not work

CREATE FUNCTION igual() RETURNS trigger AS '
BEGIN
  new.numero2:=numero1;
  return new;
END
' LANGUAGE plpgsql;

CREATE TRIGGER igual AFTER INSERT 
        ON datos FOR each ROW
        EXECUTE PROCEDURE igual();

When inserting new data gives this error

ERROR:  no existe la columna «numero1»
    
asked by hugoboss 18.05.2018 в 19:49
source

0 answers