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/config
with:[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 schema
now: (#441, #446, #465, #478, #471, #480, #441)- Uses
--message-format=json
on somecargo
invocations and captures that output. - Generates a 'stub' of the relevant
postmaster
binary (found viapg_config
). dlopen
s that 'stub'.dlopen
s the extension.- Calls the
pgx_utils::sql_entity_graph::PgxSql
builders as thesql-generator
used to.
- Uses
- Most
cargo pgx
commands now support the--package
arg matchingcargo
's.
Please note unlikecargo
,cargo pgx
does not support multiple--package
args at this time. (#475 ) pgx::datum::sql_entity_graph
andpgx_utils::sql_entity_graph
are merged and present inpgx_utils::sql_entity_graph
together. (#441)cargo pgx schema
now outputs to/dev/stdout
by default, use--out
to specify a destination, or pipe the stdout. (#465 )pgx_utils
is now exported from atpgx::utils
, this is primarily to exposepgx_utils::sql_entity_graph
without requiring users havepgx_utils
in theirCargo.toml
. (#441)- The
sql-generator
binary,.cargo/pgx-linker-script.sh
and related.cargo/config
settings are no longer needed. The old.cargo/config
from 0.1.2x is back. (#441) pgx_graph_magic!()
now expands with__pgx_source_only_sql_mappings
and__pgx_typeid_sql_mappings
symbols, allowingcargo-pgx
to get the appropriate SQL mappings. (#441)cargo pgx test
andcargo pgx install
had several changes to make them more appropriately and cleanly capture and pass build data for this new process. (#441)- Most
sql_graph_entity
related functions got a#[doc(hidden)]
attribute to clean up their docs. (#441) RUST_LOG
env vars get correctly passed inpgx test
. (#441)- Some unnecessary dependencies and features were pruned. (#436)
pgx-pg-sys
now 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-parent
crate was removed, thepgx-examples
directory members are now workspace members, and the workspaces usesresolver = "2"
. (#456) - The
pgx-examples
no 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
initdb
ortar
(#484) - Improved our Nix support to allow
singleStep = false
, improving rebuild speed, we also tweaked the Nix CI samples. (#474, #485) - Fixed
pgx-tests
failing ondoc.rs
. (#468)