pawurb / ruby-pg-extras

Ruby PostgreSQL database performance insights. Locks, index usage, buffer cache hit ratios, vacuum stats and more.
MIT License
124 stars 11 forks source link

Delegate database_url string parsing to PG #8

Closed holmesie closed 2 years ago

holmesie commented 2 years ago

Hello! First off, thank you for this library.

I'm having trouble using it with an Azure hosted postgres database, which defaults to a username of the format username@hostname. In order to satisfy the URI.parse here: https://github.com/pawurb/ruby-pg-extras/blob/master/lib/ruby-pg-extras.rb#L162, you have to escape the @ with a %40. That escaped value doesn't get unescaped here: https://github.com/pawurb/ruby-pg-extras/blob/master/lib/ruby-pg-extras.rb#L168, which causes the connection to fail.

Is there any appetite for utilizing the full PG.connect parsing behavior, similar to ActiveRecord in Rails? It handles a few different use cases, including the one advertised in ruby-pg-extra's README.md. It also handles my edge case. This is what I mean: https://github.com/ged/ruby-pg/blob/master/lib/pg/connection.rb#L80-L93.

Thanks again!

pawurb commented 2 years ago

Thanks! I've just released it as 3.3.0.