From d4e7d2326890f3dcd6a5ffd632ca609ac222f716 Mon Sep 17 00:00:00 2001 From: Laurence Isla Date: Wed, 12 Jun 2024 19:27:53 -0500 Subject: [PATCH] docs: fix example of listener failure on read replicas --- docs/references/listener.rst | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/references/listener.rst b/docs/references/listener.rst index 7384cd611..09af8b200 100644 --- a/docs/references/listener.rst +++ b/docs/references/listener.rst @@ -22,9 +22,17 @@ Listener on Read Replicas The ``LISTEN`` and ``NOTIFY`` commands do not work on PostgreSQL read replicas. Thus, if you connect PostgREST to a read replica the Listener will fail to start. -.. code:: console +.. code:: psql - 12/Jun/2024:15:19:57 -0500: Failed listening for notifications on the "pgrst" channel... connection to server... failed: session is read-only + -- check if the instance is a replica + postgres=# select pg_is_in_recovery(); + pg_is_in_recovery + ------------------- + t + (1 row) + + postgres=# LISTEN pgrst; + ERROR: cannot execute LISTEN during recovery To work around this, you can connect the Listener to the primary while still using the :ref:`connection_pool` on the replica.