Skip to content

Releases: pgcentralfoundation/pgrx

v0.3.2

16 Feb 17:09
30b7a87

Choose a tag to compare

Upgrading

Please make sure to run cargo install cargo-pgx and update all the pgx extension Cargo.toml's pgx* versions to 0.3.2.

What's Changed

  • Fix: Resolved an issue in #[pg_extern(..)] functions with attributes that also returned tuples. A change in #410 caused incorrect macro expansion. (#440)

v0.3.1

11 Feb 19:59
ed9f061

Choose a tag to compare

Upgrading

Please make sure to run cargo install cargo-pgx and update all the pgx extension Cargo.toml's pgx* versions to 0.3.1.

What's Changed

  • Fix: We correctly use the right fcinfo ident if it's renamed in a #[pg_extern]. (#433)
  • We repaired some Cargo.toml metadata. (#434)

v0.3.0

09 Feb 21:58
cda8838

Choose a tag to compare

Upgrading

Please make sure to run cargo install cargo-pgx and update all the pgx extension Cargo.toml's pgx*versions to 0.3.0.

We do not expect users to require additional actions on upgrade, but we recommend any usage of the pgxsql be converted to use the new sql = "some string" available on the macros. We expect pgxsql support to be removed in the future, before 1.0.0.

Features

  • Aggregates are now supported. Explore the Rustdocs of pgx::Aggregate and pgx::pg_aggregate, or the aggregate example to learn more. (#230, #406, #418, #428)
  • cargo pgx has a new coat of paint as Clap was upgraded to 3.0. (#368)
  • cargo pgx will now do some validation that it is being run on a crate which uses a compatible pgx version. (#389)
  • cargo pgx and the sql-generator have more observability and improved error handling. Try exploring --verbose! (#372)
  • cargo pgx related commands now treat the pgversion as optional if some pgversion is part of the extension's default features. (#402)
  • You can now have extensions which are #[no_std]. While pgx still uses std, this can be a partial measure to limiting what an extension (or, for example plrust) might be able to do on a system. (#385)
  • pgx::Internal has an expanded API like get_or_insert_default(). (#419)
  • Most pgx related attribute macros now support sql = false, sql = "string", or sql = some::func::path to configure how they generate SQL. (#410, #422)
  • Nix users will find lib.buildPgxExtension in the flake.nix. (#358, #360, #361)

Other changes

  • PgBox acquired new() and new_in_context() functions. (#421)
  • The pg_sys::TimestampTz type alias now has an SQL mapping. (#400)
  • pgx::memcxt::PgMemoryContexts related closures now take a FnOnce, this makes them considerably more flexible as they can capture their environment. (#390)
  • pgx-pg-sys should hopefully be able to build on Docs.rs! (#386)
  • default!() macros can now handle negative values. (63f5e6e)
  • The new cargo pgx schema --skip-build flag uses existing artifacts. (#255)
  • @CARGO_VERSION@ in the .control file is now supported in the SQL generation. (#409)
  • Fixed some help text in cargo pgx init. (https://github.com/zombodb/pgx/pull/415)\
  • For users who already have PGUSER set, it was previously possible to encounter some issues during cargo pgx use. (#380)
  • For x86_64-unknown-linux-musl and aarch64-unknown-linux-musl users, schema generation is now supported. (#362, #365)
  • For Nix users, debug and doCheck are now supported. (#349, #401)
  • For Mac Nix users, glibc was broken, it's no longer include it on Mac. (#335)
  • For Mac ARM users, cargo pgx will now handle removing libraries when needed due to code-signing. (#333, #420)
  • For CentOS 7 or other older-distro users, some problems were noted with GCC 4. (#387)
  • General dependency updates and lint fixing. (#339, #364, #405, #414)

Thanks!

Thanks to @JamesGuthrie (from @timescale), @bitwalker (from @timescale), @robins , and @volks73 for their contributions!

v0.2.6

08 Dec 23:39

Choose a tag to compare

This is pgx v0.2.6. It fixes issue #320 along with some Nix support fixes as well (PR #305).

Please make sure to run cargo install cargo-pgx and to update your crate dependency versions.

v0.2.5

19 Nov 20:23

Choose a tag to compare

pgx v0.2.5 fixes an issue where Spi::get_one_with_args() would cause Postgres to segfault if one of the query arguments is NULL (None). It also improves our Nix support.

Thanks

Thanks to @bbigras for finding the SPI issue and also for the Nix support improvements!

What's Changed

New Contributors

Full Changelog: v0.2.4...v0.2.5

v0.2.4

12 Nov 20:11

Choose a tag to compare

This is pgx v0.2.4. It resolves (as best as possible) a compilation performance regression (#287) by only compiling the sql-generator binary when it's required. It also adds a few more Postgres headers for additional bindings around time/date and non-UTF8 encodings (PR #289).

Please make sure to run cargo install cargo-pgx along with updating your extension's Cargo.toml dependencies to point to this version.

v0.2.3

09 Nov 21:47

Choose a tag to compare

This is pgx v0.2.3. It is a minor bugfix release that fixes an issue with doing "special token" replacements in the generated (and copied) .sql files.

v0.2.2

09 Nov 16:31

Choose a tag to compare

This is pgx v0.2.2. It fixes an issue where #[pg_extern] functions that return a (rust) tuple would forget their attribute values.

v0.2.1

08 Nov 20:08

Choose a tag to compare

This is pgx v0.2.1. It's a bugfix release related to schema generation issues.

Fixed

New

v0.2.0

04 Nov 17:44

Choose a tag to compare

This is pgx v0.2.0. It represents months of work on new tooling around automatic SQL schema generation, Postgres 14 support, various safety improvements, and some user-facing (breaking) API changes.

We thank everyone that helped test the betas and are excited to finally release v0.2.0!

Upgrading

Please make sure to run cargo install cargo-pgx and update all pgx extension Cargo.toml file "pgx*" dependency versions to 0.2.0.

Features

  • PostgreSQL v14 support (#245)
  • The pgx SQL generation system has been rewritten! It now uses the proc macro system and has several breaking changes. Please refer to the migration guide below. (#165, #197)
  • The PostgreSQL uuid type is now supported! (#172)
  • cargo pgx test now accepts an optional testname. cargo pgx test specific::path works just like cargo test! (#186)
  • pgx-pg-sys now suggests you install rustfmt if you don't have it. (#193)
  • cargo pgx schema will now emit informational messages if extension Cargo.toml settings are not what is expected. (#209)
  • cargo pgx test now has a --workspace argument matching the equivalent on cargo test. (#169)

Other changes

  • fix: Marked several functions as unsafe as they had undefined behavior when passed invalid pointers. (#210, #216, #217, #223, #224, #226)
  • Type oids don't need to be looked up in functions that don't use them. (#168)
  • Added an aggregate example. (#187)
  • Updated many of our dependencies. (#191)
  • More documentation has been added to several macros and SQL generation related types. (#192, #158, #219)
  • An articles/ directory now exists in the repo and includes links to different articles written about pgx. (#198)
  • Document our MSRV (#157)
  • Fixed an accidental circular dependency in 0.2.0-beta.0 (unpublished).
  • Resolve undefined behavior around exported function symbols (#241)
    • As a result there is now pgx::direct_function_call() and pgx::direct_pg_extern_function_call() for dynamically calling internal Postgres functions and functions you declare as #[pg_extern].
  • Fix up Darwin linking issues (#244)
  • Resolve issues with sql entity graph generation (#236, #260)
  • #[pg_extern] functions with lifetimes no longer cause compiler errors (#268)
  • Add a --no-schema flag to cargo pgx run/test/install which avoids generating the schema again. This can help speed up the development cycle if you haven't made any code changes that would affect the SQL schema (#262)
  • #[pg_extern] no longer fails with return types with lifetimes inside Option<...> (#270)
  • PgBox has been rewritten to be the size of a single pointer (usize). Its user-facing API is the same, but you may need to add declare an associated type of AllocatedByPostgres or AllocatedByRust depending on usage context
  • The Internal type is no longer generic, and its API has been changed to provide typed getter functions. It is also documented.

Migration Guide

  1. Update your cargo-pgx: cargo install --force cargo-pgx --version 0.2.0-beta.0

  2. In your Cargo.toml, set crate-type to include "rlib" and profile.dev.lto to be "thin":

    [lib]
    crate-type = ["cdylib", "rlib"]
    
    [profile.dev]
    lto = "thin"
  3. Tell cargo-pgx to force update your .cargo/ and src/bin files it needs: cargo pgx schema -f

  4. Remove any sql/*.generated.sql files, as well as the load-order.txt.

  5. For each sql/*.sql remaining, insert extension_sql_file!("../sql/that_file.sql"); into your src/lib.rs

  6. If the files depend on entities which already exist, you might need to set a requires attribute:

    extension_sql_file!("../sql/that_file.sql", requires = [ dogs::parts::Floof, some_fn, ]);
  7. For any mod floof { fn boop() { todo!() } } style blocks you were using to infer schema name (making that function floof.boop), decorate the schema with #[pg_schema]:

    #[pg_schema]
    mod floof {
        fn boop() {
            todo!()
        }
    }
  8. For any functions have a custom sql block for (like below), update that to use pgxsql now:

    /// ```sql <-- Change this to `pgxsql`
    /// CREATE OR REPLACE FUNCTION  ....
    /// ```
    #[pg_extern]
    fn dot_dot_dot() { todo!() }
  9. Run cargo pgx schema again!

If you have any trouble, try running cargo pgx schema -v and investigating the output. We made sure to update the cargo doc output of pgx with updated usage for the various macros and derives, they might have some advice, too.

You can ask us questions via issues here or Discord if you get stuck.

Thanks!

Thanks to @JLockerman (from @timescale) & @kpumuk for contributions! Also thanks to our early testers @rustprooflabs and @comdiv.