demo=# ALTER TABLE a ADD COLUMN d VARCHAR;
ALTER TABLE
demo=# UPDATE a SET d=current_date;
UPDATE 3
demo=# SELECT * FROM a WHERE d=current_date;
ERROR: operator does not exist: character varying = date at character 24
HINT: No operator matches the given name and argument type(s). You
might need t
o add explicit type casts.
LINE 1: SELECT * FROM a WHERE d=current_date;
so and now think what takes happen in plpgsql functions if you work with
variables.
DECLARE z INTEGER;
calculations
UPDATE a SET b=z WHERE xyz;
GET DIAGNOSTICS rows = ROW_COUNT;
IF rows=0 THEN
ELSE
FOR r IN SELECT * FROM a WHERE b=z....
END IF;
i know that are hypotethical issues but i will show the risk.