Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diagnose does not accept args options like elsewhere #46

Closed
andyatkinson opened this issue Dec 13, 2023 · 2 comments
Closed

Diagnose does not accept args options like elsewhere #46

andyatkinson opened this issue Dec 13, 2023 · 2 comments

Comments

@andyatkinson
Copy link
Contributor

andyatkinson commented Dec 13, 2023

Since I could run:

bin/rails runner 'RailsPgExtras.table_cache_hit(args: { schema: "rideshare" })'

to check the table_cache_hit rate, I thought I could do something similar for diagnose, specifying a custom schema, but that's not supported:

bin/rails runner 'RailsPgExtras.diagnose(args: { schema: "rideshare" })'

....
rails-pg-extras-5.3.0/lib/rails-pg-extras.rb:53:in `diagnose': unknown keyword: :args (ArgumentError)
        from /Users/andy/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.2/lib/rails/commands/runner/runner_command.rb:46
...

Apologies if I missed this since I admittedly didn't dig into this deeply, but I know for system catalogs we might not need to set a schema, but for custom schemas used with apps, where tables are located, presumably diagnose needs to access those, and we'd need to set a schema to be included in SQL queries? I'll keep playing around with this a bit but wanted to bring it up early before I forgot.

Update:

Related: #43 (comment)

@pawurb
Copy link
Owner

pawurb commented Dec 14, 2023

Diagnose is not a one off query but has a more complex logic. I think that setting default schema via ENV added in 5.3.1 should resolve it. If not it would require some rewrite of RubyPgExtras::DiagnoseData for it to accept args. I currently don't have time to look into it but PRs are always welcome.

@pawurb pawurb closed this as completed Dec 14, 2023
@andyatkinson
Copy link
Contributor Author

Thanks @pawurb I'll take a look into RubyPgExtras::DiagnoseData. I didn't really see where the queries were on initial glance (only had a few minutes to look).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants