kaido vaikla <kaido.vaikla@xxxxxxxxx> writes: > FOR r IN SELECT * FROM pg_event_trigger_dropped_objects() > LOOP > execute format ('drop role IF EXISTS r_%I', r.object_name); > END LOOP; > kvpg2=# drop schema test; > ERROR: null values cannot be formatted as an SQL identifier > CONTEXT: PL/pgSQL function trigger_after_drop_schema() line 7 at EXECUTE > Question, what i do wrong? Assume that every dropped object has a name, looks like. You would probably do well to check object_type before trying to drop the role. regards, tom lane