How are you handling the tenant reset here? Is SET LOCAL always running inside the request transaction?
[flagged]