Skip to content

Releases: pgcentralfoundation/pgrx

v0.2.0

04 Nov 17:44
Compare
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.

v0.2.0-beta.4

27 Oct 23:22
Compare
Choose a tag to compare
v0.2.0-beta.4 Pre-release
Pre-release

This is pgx v0.2.0-beta.4. It resolves issue #270.

v0.2.0-beta.3

27 Oct 18:32
Compare
Choose a tag to compare
v0.2.0-beta.3 Pre-release
Pre-release

This is pgx v0.2.0-beta.3. It fixes a few issues reported during beta2.

Fixed Issues

  • #268: #[pg_extern] functions with lifetimes no longer cause compiler errors
  • #262: 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

v0.2.0-beta.2

21 Oct 21:21
7fdee34
Compare
Choose a tag to compare
v0.2.0-beta.2 Pre-release
Pre-release

This is pgx v0.2.0-beta.2. As the second beta in the 0.2.0 series, it adds a few small features and a handful of bugfixes.

If upgrading from the 0.1.x series, please see the release notes for beta1 (https://github.com/zombodb/pgx/releases/tag/v0.2.0-beta.1).

New Features

  • PostgreSQL v14 support (#245)

Bug Fixes

  • 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)

Thanks!

Thanks to everyone that contributed testing and issue reports during this beta. Most especially @rustprooflabs!

v0.1.25

19 Oct 17:23
f38ab31
Compare
Choose a tag to compare

This is a follow-up to v0.1.24 that resolves safely issues around trapping Rust panics and Postgres ERRORs across FFI boundaries.

This will be the last release in the 0.1.x series (and this time we mean it!), and the previous v0.1.23/v0.1.24 releases will be yanked from crates.io.

v0.1.24

06 Oct 18:56
Compare
Choose a tag to compare

This is pgx v0.1.24. It is a follow-up to the v0.1.23 release which inadvertently broke shared memory support. This release fixes that.

Also note that this will be the last release in the 0.1.x series, as we are finalizing a v0.2.0 release which brings some breaking changes along with PostgreSQL 14 support.

v0.1.23

05 Oct 18:17
Compare
Choose a tag to compare

This is pgx v0.1.23. This is a soundness/safety release that fixes undefined behavior related to functions declared as #[pg_extern]. Primarily, it resolves issue #241.

v0.2.0-beta.1

25 Sep 02:00
d9c1db5
Compare
Choose a tag to compare
v0.2.0-beta.1 Pre-release
Pre-release

Features

  • 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).

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.

v0.1.22

29 Aug 19:51
Compare
Choose a tag to compare

This is a minor update to pgx that adds support for FreeBSD (issue #179) and also uses CREATE EXTENSION .. CASCADE during cargo pgx test (issue #177).

v0.1.21

01 May 20:51
e12d8e8
Compare
Choose a tag to compare

pgx v0.1.21 is a minor feature release with the following features:

Changes

  • aarch64 support was added (#127)
  • add Nix flake (#124)
  • cargo-pgx pgx init does initdb (#123)
  • Improve handling of feature flags (#118)
  • Allow overriding function names and returning schema-qualified type (#117)
  • update dependencies (#122).
  • (docs) Add caveat about reconnecting after updating extension (#116)

Other Changes

  • (cargo-pgx) on init, lazy fetch version list (#119)

To upgrade, please run:

$ cargo install cargo-pgx --version 0.1.21

Also, make sure to update your Cargo.toml dependencies.

Thanks!

Thanks to @JLockerman from @timescale for the PRs. And of course special thanks to @Hoverbear for her work on this release!