Skip to content

Releases: pgcentralfoundation/pgrx

v0.0.16

01 Oct 22:37
Compare
Choose a tag to compare

This is pgx v0.0.16. It is a minor bugfix release that fixes an issue with cargo pgx where its schema generator would copy extension SQL upgrade scripts to the wrong directory.

To update, you must run

cargo install cargo-pgx

v0.0.15

29 Sep 15:07
Compare
Choose a tag to compare

This is pgx v0.0.15. It contains a number of fixes and new features.

Please make sure to update the cargo-pgx subcommand to v0.0.15 by running:

$ cargo install cargo-pgx

New Features

  • Returning a Vec<T> where T: PostgresType from a #[pg_extern] function is now supported

  • When building pgx iself, failing to specify the Postgres version feature (ie, --features "pg12") now results in one compilation error instead of thousands.

  • pgx's schema generator now applies a search_path setting to every #[pg_extern]/#[pg_operator] function it generates. This change now requires that extensions be relocatable = false. This is set in the extension's .control file and needs to be updated as the previous default was true. Failure to do so will result in an error during pgx's schema generation phase.

  • Postgres versions are updated to the latest point releases. If you'd like to also upgrade to those, simply re-run cargo pgx init. Your existing databases will be preserved.

  • cargo pgx test now has a --release flag.

  • Invent cargo pgx connect pgXX to connect to the specific Postgres instance without compiling/installing an extension.

  • New #[derive(PostgresEq, PostgresOrd, PostgresHash) traits for automatically generating semantically equivalent Postgres operator functions, along with operator classes/families, allowing such types to be used in Postgres btree and hash indices.

  • The extension_sql!() macro is validated at compile time.

  • Safe support for Postgres' Shared Memory and LWLock system. We currently support custom types (Copy/Clone), types from heapless, and standard Rust atomics -- allowing for safe usage of these types across Postgres backends.

  • The _PG_init() and _PG_fini() functions now only need #[pg_guard] applied. It is no longer necessary to apply #[allow(non_snake_case)] to avoid compiler warnings.

Fixes

  • pgx's schema generator now processes .rs files in alphabetical order to
    ensure consistency across platforms/filesystems

  • Adjust the order in which DDL objects are generated

  • Functions behind #[pg_guard] are no longer allowed to be called by threads. Doing so will result in a panic!(). This ensures, at runtime, that function calls to Postgres only happen on the main thread. This check is disabled in --release builds to avoid runtime overhead in such builds.

  • panic!()s from threads are logged to stderr (which should go to your Postgres log file), rather than being converted into Postgres ereport(ERROR)s.

v0.0.14

07 Sep 00:00
Compare
Choose a tag to compare

This is pgx v0.0.14. It is an important update as it resolves incompatibilities with recent changes to upstream dependencies.

Please make sure to run cargo install cargo-pgx to update your cargo-pgx version. While always important for a new version of pgx, it's doubly important for this release as it's the cargo subcommand that exhibits most of the incompatibility problems.

Bugs Fixed

  • Issue #42: Resolve issues with a breaking change in proc-macro2
  • Issue #40: bgworker example works now. Also don't pass Postgres' various PGXXX environment variables through during cargo pgx run/test

Other Changes

  • minor documentation updates
  • Add libpq/auth.h to bindings generation
  • 82461d1: if a non-main thread tries to call a function under #[pg_guard], we now panic
  • 415b83e: extern "C" functions don't need #[no_mangle] unless it's _PG_init
  • 40010be: add a function to PgRelation to open a relation with a share lock

Please Sponsor Our Work

Please consider sponsoring our work on pgx through GitHub's Sponsorship Program. Sponsorship keeps this project alive and moving forward. Thank you!

v0.0.13

16 Aug 16:48
Compare
Choose a tag to compare

This is pgx v0.0.13. It's a feature and bug fix/cleanup release.

When upgrading, please ensure to run cargo install cargo-pgx to update its cargo subcommand.

New Features

  • The PostgresType trait can now project Rust Copy + Sized types from a Postgres "varlena", providing for zero-copy types between Postgres<-->Rust boundaries. See the documentation and examples for details.

Bug Fixes/Cleanups

  • Fix cargo pgx run reload order to avoid possible Postgres segfaults
  • Fix ^C passthrough to psql via cargo pgx run
  • Fix Postgres v10 incompatibility when autogenerating CREATE OPERATOR DDL
  • Cleanup pgx-tests crate so that its tests don't interfere with 3rd-party tests
  • Cleanup code generation for wrapped functions, including multiple unnecessary levels of pg_sys::guard::guard()
  • Removed the DetoastedVarlena and OwnedVarlena types -- these were ill-conceived and otherwise dead code. You probably want the new PgVarlena type.

Thanks!

Thanks to everyone using pgx, reporting issues, and especially submitting pull requests.

Sponsor our Work

Please consider sponsoring our work on pgx (and ZomboDB, by choosing a sponsorship tier. Your sponsorship, at any tier, is greatly appreciated and helps keep pgx and ZomboDB free and actively developed!

v0.0.12

04 Aug 18:38
Compare
Choose a tag to compare

crates.io badge
docs.rs badge
Twitter Follow

A quick bugfix release to fix a problem with cargo pgx new failing to properly create a new extension project.

v0.0.11

04 Aug 17:32
Compare
Choose a tag to compare

This is a minor update from v0.0.9 that gets pgx's documentation building on docs.rs. No user-facing changes have been made.

docs.rs badge

v0.0.9

03 Aug 17:31
Compare
Choose a tag to compare

This is pgx v0.0.9. It is a bugfix and new feature release. Primarily, it brings support for safely creating Postgres Background Workers.

New Features

  • PRs #5 & #26: Background worker support. See pgx-examples/bgworker for an example.

    • There's also a new flag named --bgworker to cargo pgx new <extname> to automatically create a template Background Worker extension crate
    • Thanks @jamessewell!
  • Issue #23: #[pg_extern] functions can now return Rust tuples, which translate into an UDF that RETURNS TABLE (..., ...).

  • Issue #28: #[pg_operator] macro now exists, which works exactly like #[pg_extern], but will auto generate the CREATE OPERATOR DDL for you. This is useful when defining operators for custom data types. See pgx-examples/operators.

  • PR #27: cargo pgx init now honors http proxy settings from your environment. Thanks @diegopy!

  • PR #30: cargo pgx start <PGVER> now specifies the "unix_socket_directories" when starting Postgres, which is simply ~/.pgx/. Thanks @jamessewell!

Other Changes/Fixes

  • Properly detoast arrays. This was a regression from v0.0.8
  • Add a FromDatum implementation for pgx::Numeric
  • Add ability to create a pgx::PgTupleDesc from a composite pgx::pg_sys::Datum
  • Add a --release flag to cargo pgx run for interactively testing a release build of your extension
  • cargo pgx run spawns psql using execvp(), which means it'll properly handle, among other things, ^C
  • Ensure SPI_finish() always gets called, even in the face of errors/panics
  • Fix PgTryResult::unwrap_or()/unwrap_or_else() to call Postgres' FlushErrorState()
  • Make GitHubActions build much faster

Sponsor our Work

Please consider sponsoring our work on pgx (and ZomboDB, by choosing a sponsorship tier. Your sponsorship, at any tier, is greatly appreciated and helps keep pgx and ZomboDB free and actively developed!

Thanks!

Thanks to all y'all that have been using pgx, reporting issues, and especially submitting pull requests.

v0.0.8

28 Jul 17:40
Compare
Choose a tag to compare

pgx v0.0.8 has been released. This is a bugfix and feature release.

New Features

  • Issue #18: #[derive(PostgresType)] now works for structs that contain borrowed data (ie, they have lifetimes). These are encoded as JSON, whereas fully-owned structs are encoded as CBOR
  • Issue #19: pgx now supports Postgres' bytea type, which can be represented in Rust as &[u8] or Vec<u8>. There's also an example for this that demonstrates gzipping bytea data

Bug Fixes

  • Issue #21: Rust's unit type (()) is now translated into a Postgres void
  • Issue #21: Rust's char type is now translated into a Postgres varchar
  • Issue #21: Postgres' "char" type (note the quotes!) is now translated into a Rust i8

Upgrading

When upgrading to this version, please ensure to run cargo install cargo-pgx in addition to updating your Cargo.toml files.

Sponsor Our Work

Please consider sponsoring our work on pgx. Sponsorships help keep pgx open-source and actively developed. Thanks for your consideration!

v0.0.7

19 Jul 22:48
Compare
Choose a tag to compare

This is pgx v0.0.7. The version was bumped from v0.0.3 so that the various dependency crates and the cargo-pgx subcommand can track with the same version numbers going forward.

This release brings lots of new features to cargo-pgx, some bugfixes around SPI support, inclusion of Postgres' FDW APIs, and more documenation.

Please make sure to update your Cargo.toml pgx dependency versions to 0.0.7!

What's New?

  • Significant reworking of the cargo-pgx subcommand.

    • execute cargo install cargo-pgx again to upgrade it to v0.0.7.
    • contains many new command such as 'init', 'run', 'package', 'start/stop/status'. See its README for details, screenshots, and a link to an instructional video
    • Regardless of if this is your first time using pgx, you now need to run cargo pgx init at least once
    • Our hope is that these cargo-pgx changes bring major QoL improvements. If you see anything else it needs, please create an issue.
  • include Postgres' Foreign Data Wrapper API headers in the pgx::pg_sys module

Bugfixes

  • fix use-after-free bugs with SPI when returning &str or PgBox<T> values

Support Our Work

Please consider sponsoring our work at our GitHub Sponsors Page.