github pgcentralfoundation/pgrx v0.4.0-beta.0

latest releases: v0.11.4, v0.12.0-alpha.1, v0.12.0-alpha.0...
pre-release2 years ago

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-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 and pgx_utils::sql_entity_graph are merged and present in pgx_utils::sql_entity_graph together. (#441)
  • pgx_utils is now exported from pgx at pgx::utils, this is primarily to expose pgx_utils::sql_entity_graph without requiring users have pgx_utils in their Cargo.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, allowing cargo-pgx to get the appropriate SQL mappings. (#441)
  • cargo pgx schema now: (#441)
    1. Uses --message-format=json on some cargo invocations and captures that output.
    2. Processes that JSON to find the OUT_DIR used by the relevant pgx_pg_sys build.
    3. It uses that OUT_DIR data to read, generate, then build (with rustc) a 'stub' shared object. (This gets cached!)
    4. dlopens that shared object.
    5. dlopens the extension.
    6. Calls the pgx_utils::sql_entity_graph::PgxSql builders as the sql-generator used to.
  • cargo pgx test and cargo 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, and cargo 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 in pgx 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, the pgx-examples directory members are now workspace members, and the workspaces uses resolver = "2". (#456)

Don't miss a new pgrx release

NewReleases is sending notifications on new releases.