v0.4.0-beta.0
Pre-releaseThis 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-beta.0
and update all the pgx
extension Cargo.toml
's pgx*
versions to 0.4.0-beta.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"]
Nix user? Make sure to nix flake lock --update-input pgx
as the pgx
flake had it's lib.buildPgxExtension
updated as well.
What's Changed
pgx::datum::sql_entity_graph
andpgx_utils::sql_entity_graph
are merged and present inpgx_utils::sql_entity_graph
together. (#441)pgx_utils
is now exported frompgx
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 schema
now: (#441)- Uses
--message-format=json
on somecargo
invocations and captures that output. - Processes that JSON to find the
OUT_DIR
used by the relevantpgx_pg_sys
build. - It uses that
OUT_DIR
data to read, generate, then build (withrustc
) a 'stub' shared object. (This gets cached!) dlopen
s that shared object.dlopen
s the extension.- Calls the
pgx_utils::sql_entity_graph::PgxSql
builders as thesql-generator
used to.
- Uses
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)cargo pgx schema
,cargo pgx install
, andcargo pgx package
all had outputs changed. (#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)
- 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)