fix: call _heroku.pg_stat_statements_reset() on Essential and Advanced plans#3751
Conversation
…plans The real pg_stat_statements_reset is no longer granted to tenants on Aurora (Essential/Advanced) — they now have a SECURITY DEFINER wrapper in the _heroku schema scoped to the current database only. Standard and below continue to call the real function directly.
getDatabase returns ConnectionDetails without plan info. Use getAttachment to get the addon with plan and correctly detect Essential/Advanced plans.
|
@dasofiei I did a small change removing the extra resolution step, because the add-on info is already present on the In my case that I was testing against prod, for Advanced and Essential DBs I've got an error related with the wrapper function not existing in the database engine, but I guess that has to do with the backend not being updated yet. Can you test against your development add-on and let me know if everything looks ok? That way I can approve and merge and we should be ready for the release. |

Summary
heroku pg:outliers --resetwas callingpg_stat_statements_reset()directly for all plansSECURITY DEFINERwrapper_heroku.pg_stat_statements_reset()scoped to the current database onlygetAttachmentto detect the plan and calls the right function per fleet:SELECT _heroku.pg_stat_statements_reset()SELECT pg_stat_statements_reset()Change is not in shogun yet, it will be merged on Monday evening, right before the minor release.
There will be a brief period of time where the reset cli command won't work for essential & performance plans, in-between shogun release & cli release.
It can be tested using my shogun as below.
Type of Change
Testing
Tests:
End-to-end:
Related
Shogun PR: https://github.com/heroku/shogun/pull/22200
Reset docs -> https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-pg-outliers-database