"Oleg Serov" <serovov@gmail.com> writes:
> CREATE OR REPLACE FUNCTION "bug_with_triggers" () RETURNS trigger AS
> $body$
> BEGIN
> PERFORM COALESCE(NEW.some_composite_field.field, TRUE);
> END;
> $body$
> LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
> Error:
> ERROR: NEW used in query that is not in a rule
I agree that this error message is pretty unhelpful, but the code is
wrong anyway. The correct way to do this is
PERFORM COALESCE((NEW.some_composite_field).field, TRUE);
regards, tom lane