Hi,
On 2022-03-28 15:57:37 +0300, a.sokolov@postgrespro.ru wrote:
> + data initialization. It is vital that any event trigger using the
> + <literal>login</literal> event checks whether or not the database is in
> + recovery.
>
> Does any trigger really have to contain a pg_is_in_recovery() call?
Not *any* trigger, just any trigger that writes.
> In this message
> (https://www.postgresql.org/message-id/20220312024652.lvgehszwke4hhove%40alap3.anarazel.de)
> it was only about triggers on hot standby, which run not read-only queries
The problem precisely is that the login triggers run on hot standby nodes, and
that if they do writes, you can't login anymore.
Greetings,
Andres Freund