v0.4.0
This release reworks the SQL generation process present in 0.2.x and 0.3.x, resulting in approximately 50% faster linking times for most commands.
The usability of #[pgx(sql = some_func)] has also improved, as we are now invoking these functions from the shared object itself, instead of some separate binary.
Upgrading
This release requires some manual intervention for all users, as we have updated the SQL generation process. We discovered a new (significantly faster and more safe) way to generate SQL that doesn't require the sql-generator binary or linker scripts.
Additionally, only users of #[pg_extern(sql = some_func)] (and thus using the pgx::datum::sql_entity_graph) should be aware that pgx::datum::sql_entity_graph was merged with pgx_utils::sql_entity_graph and is available at pgx::utils::sql_entity_graph now.
Steps to upgrade:
Please make sure to run cargo install cargo-pgx --version 0.4.0 and update all the pgx extension Cargo.toml's pgx* versions to 0.4.0.
Then:
- Remove
.cargo/pgx-linker-script.sh,src/bin/sql-generator.rs.rm .cargo/pgx-linker-script.sh src/bin/sql-generator.rs
- Replace
.cargo/configwith:[build] # Postgres symbols won't be available until runtime rustflags = ["-C", "link-args=-Wl,-undefined,dynamic_lookup"]
- In your
Cargo.toml:[lib] + crate-type = ["cdylib"] - crate-type = ["cdylib", "rlib"]
What's Changed
cargo pgx schemanow: (#441, #446, #465, #478, #471, #480, #441)- Uses
--message-format=jsonon somecargoinvocations and captures that output. - Generates a 'stub' of the relevant
postmasterbinary (found viapg_config). dlopens that 'stub'.dlopens the extension.- Calls the
pgx_utils::sql_entity_graph::PgxSqlbuilders as thesql-generatorused to.
- Uses
- Most
cargo pgxcommands now support the--packagearg matchingcargo's.
Please note unlikecargo,cargo pgxdoes not support multiple--packageargs at this time. (#475 ) pgx::datum::sql_entity_graphandpgx_utils::sql_entity_graphare merged and present inpgx_utils::sql_entity_graphtogether. (#441)cargo pgx schemanow outputs to/dev/stdoutby default, use--outto specify a destination, or pipe the stdout. (#465 )pgx_utilsis now exported from atpgx::utils, this is primarily to exposepgx_utils::sql_entity_graphwithout requiring users havepgx_utilsin theirCargo.toml. (#441)- The
sql-generatorbinary,.cargo/pgx-linker-script.shand related.cargo/configsettings are no longer needed. The old.cargo/configfrom 0.1.2x is back. (#441) pgx_graph_magic!()now expands with__pgx_source_only_sql_mappingsand__pgx_typeid_sql_mappingssymbols, allowingcargo-pgxto get the appropriate SQL mappings. (#441)cargo pgx testandcargo pgx installhad several changes to make them more appropriately and cleanly capture and pass build data for this new process. (#441)- Most
sql_graph_entityrelated functions got a#[doc(hidden)]attribute to clean up their docs. (#441) RUST_LOGenv vars get correctly passed inpgx test. (#441)- Some unnecessary dependencies and features were pruned. (#436)
pgx-pg-sysnow only generates bindings it needs, instead of bindings for all postgres verisons. (#455)- Readme improvements. (#460, #463, #471)
- The development workspace has changed. The
pgx-parentcrate was removed, thepgx-examplesdirectory members are now workspace members, and the workspaces usesresolver = "2". (#456) - The
pgx-examplesno longer point outside the pgx directory then traverse back in. (#462) - Several new headers are exposed via
pgx_pg_sys: - Improved the error messages if a user is missing
initdbortar(#484) - Improved our Nix support to allow
singleStep = false, improving rebuild speed, we also tweaked the Nix CI samples. (#474, #485) - Fixed
pgx-testsfailing ondoc.rs. (#468)