It should raise an exception, which indeed would cause the query to fail, and roll back the whole transaction (so no side effect is committed at all).
https://www.postgresql.org/docs/current/static/plpgsql-error...