On Thursday, July 18, 2024, Hayden Sim <
haydenwillsim@gmail.com> wrote:
I understand it is a side effect of SET causing the custom GUC to be initialised. But the behaviour of `SET LOCAL` affecting the entire session, even outside of the transaction seems bizarre. Should exiting the transaction or calling `SET ... TO DEFAULT` not cause the parameter to be deleted?
Yes, it is a POLA violation. But there is no interest in fixing this, especially not as a bug fix. I suggest you instead support the commitfest patch to get proper variables into PostgreSQL.
To reiterate, it is a bug in client code to rely on NULL being a setting value (i.e., we made a mistake in providing a current setting function that produces null instead of an error.).
There is pending documentation, that probably either needs tweaks or could be modified to update different areas, in light of this discussion (touching current_setting seems warranted) to add this behavior more prominently to the docs. Reviewing that would also help.
David J.