UNLISTEN, DISCARD ALL and readonly standby - Mailing list pgsql-hackers

From Shay Rojansky
Subject UNLISTEN, DISCARD ALL and readonly standby
Date
Msg-id CADT4RqBweu7QKRYAYzeRW77b+MhJdUikNe45m+fL4GJSq_u2Fg@mail.gmail.com
Whole thread Raw
Responses Re: UNLISTEN, DISCARD ALL and readonly standby  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi hackers.

The documentation for DISCARD ALL[1] state that it is equivalent to a series of commands which includes UNLISTEN *. On the other hand, the docs for hot standby mode[1], state that UNLISTEN * is unsupported while DISCARD is (although the docs don't specify whether this includes DISCARD ALL). I haven't done a test, but this seems to indicate that while DISCARD ALL is supported in hot standby mode, UNLISTEN is not, although its functionality is included in the former.

If this is indeed the case, is there any specific reason UNLISTEN can't be supported? This is actually quite important in the case of Npgsql (.NET driver). When a connection is returned to the connection pool, its state is reset - usually with a DISCARD ALL. However, if prepared statements exist, we avoid DISCARD ALL since it destroys those (the DEALLOCATE ALL component of DISCARD ALL), and we want to keep prepared statements across connection lifecycles for performance. So instead of issuing DISCARD ALL, Npgsql sends the equivalent commands excluding DEALLOCATE ALL - but UNLISTEN * fails when in recovery.

So ideally UNLISTEN would be made to work in standby model, just like DISCARD ALL. If DISCARD ALL is in fact unsupported in hot standby mode, then the docs should probably be updated to reflect that.

Thanks for any information or advice on this!


pgsql-hackers by date:

Previous
From: Richard Guo
Date:
Subject: Re: Pull up sublink of type 'NOT NOT (expr)'
Next
From: Fabien COELHO
Date:
Subject: Re: Online verification of checksums