Hello to all the readers, I'm trying to build a login event trigger in conjonction with a multi host connectio string to manager instances roles in a logical replication cluster.
I'm surprised by the result found with (pg client 16+ on windows and linux), here is my test case: --on XX server --create a LOGIN EVENT TRIGGER --psql CREATE OR REPLACE FUNCTION init_session() RETURNS event_trigger SECURITY DEFINER LANGUAGE plpgsql AS $$ BEGIN IF session_user = 'aaaaa' THEN RAISE EXCEPTION 'Login forbidden'; END IF; END; $$; -- trigger definition CREATE EVENT TRIGGER init_session ON login EXECUTE FUNCTION init_session(); ALTER EVENT TRIGGER init_session ENABLE ALWAYS; No trigger on YY server --on ZZ server set PGPASSWORD=pass psql -d "host=XX,YY dbname=postgres port=5432 user=aaaaa" psql: error: connection to server at "XX" (xx.xx.xx.xx), port 5432 failed: FATAL: Login forbidden CONTEXT: PL/pgSQL function init_session() line 4 at RAISE ** It exits without trying connection on YY host !?** Similar connection string on JDBC work as I wish: * try XX, with error * then try YY server and succeed. Did I miss something ? Regards PAscal