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
fix(cargo-pgx): on init, lazy fetch version list #119
fix(cargo-pgx): on init, lazy fetch version list #119
Conversation
default_pgx | ||
for (pgver, pg_config_path) in versions { | ||
let config = if pg_config_path == "download" { | ||
if default_pgx.is_none() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wanna do .get_or_insert() here instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially did that too! However it ends up leaving the code more complicated, since you need to deal with the error from Pgx::default(...)?
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course. LGTM as-is.
Signed-off-by: Ana Hobden <operator@hoverbear.org>
87fba1e
to
f7d3f3d
Compare
`pgx` v0.1.21 is a minor feature release with the following features: * aarch64 support was added (#127) * add Nix flake (#124) * `cargo-pgx pgx init` does `initdb` (#123) * Improve handling of feature flags (#118) * Allow overriding function names and returning schema-qualified type (#117) * update dependencies (#122). * (docs) Add caveat about reconnecting after updating extension (#116) There were the following fixes: * (`cargo-pgx`) on init, lazy fetch version list (#119) To upgrade, please run: ``` $ cargo install cargo-pgx --version 0.1.21 ``` Also, make sure to update your Cargo.toml dependencies. Signed-off-by: Ana Hobden <operator@hoverbear.org>
`pgx` v0.1.21 is a minor feature release with the following features: * aarch64 support was added (#127) * add Nix flake (#124) * `cargo-pgx pgx init` does `initdb` (#123) * Improve handling of feature flags (#118) * Allow overriding function names and returning schema-qualified type (#117) * update dependencies (#122). * (docs) Add caveat about reconnecting after updating extension (#116) There were the following fixes: * (`cargo-pgx`) on init, lazy fetch version list (#119) To upgrade, please run: ``` $ cargo install cargo-pgx --version 0.1.21 ``` Also, make sure to update your Cargo.toml dependencies. Signed-off-by: Ana Hobden <operator@hoverbear.org>
While working on https://github.com/Hoverbear/pgx/tree/nix-flake, I determined that
cargo-pgx pgx init
would reach to network even if passed allpg_config
versions it might want.This patch defers the network call to fetch versions until it actually needs to be done.
This means a call like
Won't necessarily reach for network.