Hello! We encountered an issue with connection pooling from .Net driver ( https://github.com/npgsql/npgsql).
A few weeks ago, in order to give same access privileges for multi-service access (service/API, https://sqitch.org/, satellite services, ...), we enabled default role (`ALTER ROLE <specific role> SET ROLE <shared role>`). Feature has been validated with "scripting" (and then with a POC): ```sql select current_user; create table ...; -- check table owner ``` However, when using .Net apps we figured out owner wasn't expected one (the connection role instead of default one). After investigating our (and driver) code base. We find out that .Net driver use `DISCARD ALL` statement in order to clean-up pooled connection. While cleaning-up reused/pooled connection before they are offered back to the pool is expected in order to avoid side effects, it seems `DISCARD ALL` isn't currenty the proper way to achieve clean-up as it results in different behavior than a fresh connection. Here's test statements to check behavior of: fresh connection, `DISCARD ALL`, `RESET ROLE`, `SET SESSION AUTHORIZATION DEFAULT` and `RESET ALL`: ```sql select current_user; -- result: default role discard all; select current_user; -- result: connection role reset role; select current_user; -- result: default role set session authorization default; select current_user; -- result: connection role reset role; select current_user; -- result: default role reset all; select current_user; -- result: default role set session authorization default; select current_user; -- result: connection role reset all; select current_user; -- result: connection role ``` Can you please: 1. clarify if `DISCARD ALL` behavior is the expected one or is it a bug? 1. If not a bug, specify proper way to clean-up connection for reuse? Thank you very much for your help! Note: discussion is coming from https://github.com/npgsql/npgsql/issues/5997