20
Yes, because it's executed within the same transaction. If the trigger fails, the insert/update will also fail. Just do a test executing a query that will fail (SELECT a table that does not exist) and you can see how things work and how your application will behave.
CREATE OR REPLACE FUNCTION foo() RETURNS TRIGGER
AS
$$
BEGIN
EXECUTE 'SELECT fail';
END;
$$
LANGUAGE plpgsql;