Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update version to 0.7.0-beta.0 #1000

Merged
merged 1 commit into from
Jan 12, 2023
Merged

Update version to 0.7.0-beta.0 #1000

merged 1 commit into from
Jan 12, 2023

Conversation

eeeebbbbrrrr
Copy link
Contributor

@eeeebbbbrrrr eeeebbbbrrrr commented Jan 10, 2023

This is pgx v0.7.0-beta.0. Other than pgx' initial release, this is our biggest release yet! It contains a number of safety improvements, segfault fixes, API changes, minor performance improvements, and an overhauled Spi interface now with prepared statements and cursors!

Quite a number of people have contributed to this release, so a big thank you is necessary right here at the top. Some notable names are @yrashk and @EdMcBane for their work on Spi. And a shout-out to the new contributors: @jaskij, @kianmeng, and @ChuckHend.

To use this beta release, install cargo-pgx by version: $ cargo install cargo-pgx --version 0.7.0-beta.0 --locked and make sure to update your extension crate dependencies to use 0.7.0-beta.0 too.

API Changes

v0.7.0 contains some backwards incompatible API changes and your extension code may need to be updated as a result. Leaning on the compiler should help you through the changes.

Spi

Spi has received a major overhaul in v0.7.0. It now supports cursors, prepared statements, and runtime datum conversion error detection.

Much of the Spi API has been overhauled in a backwards-incompatible way, and is too much to document in release notes. However, the biggest change is that the various getter functions on Spi and SpiTupleTable and SpiHeapTupleData now return pgx::spi::Result<Option<T>>. The error type is pgx::spi::Error and can not only report Postgres-specific SPI_ERROR_XXX errors from Postgres but also represent runtime situations where the requested Rust type T isn't compatible with the backing Datum type.

Cursor Support Changes

Prepared Statement Support

Spi Statement "readonly" Management

Spi Error Handling

Because most Spi-related functions now return spi::Result<T>, pgx now knows how to convert a Result<T: IntoDatum, E: Any + Display> into a Datum. This means #[pg_extern]-style functions (including #[pg_test] functions) can now return a Result. This makes working with Spi much more "rust-like" and fluent.

If result is Ok then its payload is converted into a Datum. If the result is Err, then pgx will automatically raise a Postgres ERROR. Furthermore, if the Err variant's payload is a pgx ErrorReport, then that'll be raised, which can include a specific SQL error code, detail, hint, and context message.

The general work on Spi error handling happened in these PRs, with much help from @yrashk and @EdMcBane:

And the generalized support for handling Results-as-Datums came in through:

General Cleanups

This one is particularly interesting as it now allows cargo test --all --features "pgXX ... ..." to work from a top-level workspace crate:

Stability, Correctness, and Performance

Feature Flags

When enabled, pgx will not generate any code related to the "sql entity graph", thereby causing cargo-pgx to generate an empty schema.

When enabled (which is the default), pgx (specifically, pgx-pg-sys) will compile its "cshim" code and have it statically linked into the extension. Disabling this feature flag might make pgx compilation easier for platforms where the necessary Postgres C extension build requirements aren't available, however you'll lose access to a few pgx modules: hooks, list, namespace and spinlock.

Our ultimate goal is to not have a "cshim" at all, and to that end much of the old "cshim" has been ported to Rust:

More Postgres Headers

CI Updates

New Contributors

Full Changelog: v0.6.1...v0.7.0-beta.0

Copy link
Member

@workingjubilee workingjubilee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!

May want to re-regenerate bindings?

@eeeebbbbrrrr
Copy link
Contributor Author

Excellent!

May want to re-regenerate bindings?

Yeah, I need to re-create this branch since you just merged the Oid PR.

Which I'm doing now

@mhov
Copy link
Contributor

mhov commented Jan 12, 2023

congrats on 1000th PR

@eeeebbbbrrrr eeeebbbbrrrr deleted the prepare-0.7.0-beta.0 branch June 20, 2023 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants