v0.6.0-alpha.0
Pre-releaseWelcome to the first prerelease of pgx 0.6.0!
Remember to use cargo install cargo-pgx --version 0.6.0-alpha.0 --locked
!
Postgres Major Support
This release introduces support for Postgres 15 and drops support for Postgres 10, thanks to @Smittyvb, @BradyBonnette, @yrashk, and @steve-chavez.
Numeric
Thanks to @eeeebbbbrrrr, proper support for SQL's NUMERIC has landed in PGX, using two types:
AnyNumeric
Numeric<const P: u32, const S: u32>
Obviously, this breaks code using Numeric
as it currently is, which is more like AnyNumeric
.
Usage Note: As far as we are able to discern, AnyNumeric
is the type used by Postgres on SQL function entry and exit, even if you specify a precision and scale in SQL, so for the case of #[pg_extern]
you should probably prefer AnyNumeric
, and deliberately convert to Numeric<P, S>
inside functions if needed. Numeric<P,S>
helps most with serialization, writing to tables, and other cases Postgres also uses strict precision and scale.
Error Handling has been revamped
Error handling has been revamped in a way that may be breaking if you were directly handling PGX's error-handling functions, which are intended to be used when you extend this with your own error-handling abstractions. This includes a lot more support for the kinds of patterns allowed by PG_TRY
and PG_CATCH
. Take a look at PgTryBuilder
.
cargo pgx can use rustls
!
You can now configure cargo-pgx
to use rustls
instead of native SSL, but you must intentionally build it that way for now.
Data can now actually return!
@yrashk expanded the ability of various contexts to allow data to escape them: background workers can return values from transaction
, and Spi::connect
can now return values without the FromDatum + IntoDatum
bound.
Performance with soundness?
- It's now almost reasonable to use PGX with multithreading, as @thomcc gave us a true check for calling FFI from multiple threads that is more resilient to being fooled by renaming threads or other oddness you might get up to.
Array::over
is no more 🎉 andArray
is now slightly faster thanks to @workingjubilee. More changes will bring further improvements.- @eeeebbbbrrrr made
direct_function_call
have less overhead
pgx-pg-sys
build improvements
Pertinent to our Postgres version support updates, @BradyBonnette taught pgx-pg-sys
how to warn if you use an unsupported version of Postgres. @thomcc also removed our need for rayon
to build. We also gained some bindings:
- Include extension & namespace catalogs by @yrashk in #836
- Add bindings for typedefs within replication/logical.h to pg_sys by @agamble in #827
Miscellaneous Improvements
Most other changes are more subtle quality of life improvements:
- There are now safe wrappers for
SpinLock
thanks to @thomcc SpiHeapTupleDataEntry
gains an::oid
getter thanks to @workingjubileecore::ffi::CStr
is now available in Rust, and now PGX uses it consistently throughout API thanks to @thomccSpiTupleTable
exposes some getters for information oncolumns
, etc. thanks to @yrashk- We can now handle your esoteric patched Postgres version string thanks to @jteplitz
- PGX will now configure databases to use C.UTF-8 locale when it creates them thanks to @Smittyvb
- Thanks to @thomcc
#[pg_guard]
should now preserve attributes - We now have
{run,explain}_with_args
thanks to @montanalow - We now test multiple distros thanks to @BradyBonnette!
- The
indicies
function now isindices
thanks to @jteplitz - @jteplitz added support for a new PgHook
post_parse_analyze
- PostgresType now supports Rust enums as well thanks to @yrashk
New Contributors
- @jteplitz made their first contribution in #788
- @montanalow made their first contribution in #689
- @felipe-vaultree made their first contribution in #842
- @agamble made their first contribution in #827
Full Changelog: v0.5.6...v0.6.0-alpha.0