Hello!
In pgrx 0.12.0-beta.0, the first news of import is that if you run
cargo install cargo-pgrx --version 0.12.0-beta.0 --locked
You should then be able to run
cargo pgrx upgrade 0.12.0-beta.0
in your project to update all of the versions of pgrx libraries in your project's Cargo.tomls. Please let us know how it goes!
Many cargo-pgrx updates and modifications
- only build library in cargo-pgrx commands by @usamoi in #1643
- Fix cargo pgrx finding cdylibs by @workingjubilee in #1636
- Cargo pgrx upgrade by @NotGyro in #1687
cargo pgrx test --runas
by @eeeebbbbrrrr in #1652- Use
CARGO_TARGET_DIR
if available by @workingjubilee in #1662 - Only suggest
cargo install
with 1 version by @workingjubilee in #1659 - Use supports-colors feature by @theory in #1663
- Allow relocatable extensions by @NotGyro in #1653
Internal improvements
- @usamoi made most of our generated bindings
#[inline]
in #1616 which will defer codegen until the FFI guard is actually used, which should improve build times considerably - Memory management for Datum to String conversion by @sardination in #1684 should reduce allocations
- Use Ceescape's
sigsetjmp()
wrapper by @NotGyro in #1621 takes care of a UB concern wheresigsetjmp
andsiglongjmp
aren't concepts that can be reflected in Rust code, and thus must be called when Rust "isn't looking": insideasm!
. Without this, these calls may be miscompiled, because LLVM may strip the "returns-twice" codegen annotation from them. - @JelteF fixed an odd case where
OnceLock
improperly modeled the lifetime of a Postgres extension, which may persist between resets of the server by using UnsafeCell for PgLwLock and PgAtomic in #1696
New API
- Nullable type by @NotGyro in #1602
- Add one-or-none iterator conveniences by @workingjubilee in #1703
- If you enable pgrx with
features = ["nightly"]
, there is now animpl Allocator for MemCx
from @NotGyro in #1737
Time breakage
Several of our datetime APIs were incorrect in various ways. On the positive side, the remaining functions should no longer panic.
- Break Time on the anvil of proptest by @workingjubilee in #1610
- There are 1000 microseconds per millisecond by @workingjubilee in #1639
New FFI bindings
We have added many more bindings to the cshim and pgrx-pg-sys!
- feat: add more cshim bindings by @rebasedming in #1628
- feat: add
ExecCopySlotHeapTuple
topg_sys
by @rebasedming in #1635 - Redeclare additional *_walker fn by @daamien in #1629
- feat: add bindings for WAL-related functions by @rebasedming in #1675
- add user_mapping.h by @rebasedming in #1742
- add bindings of fmgroids.h, OIDs of built-in functions by @usamoi in #1726
Breakage of many functions
The pgrx::srf
module, which contained no visible code, is no longer accessible.
A number of changes in a hidden module have been done, in conjunction with alterations to the supporting code that #[pg_extern]
generates, to make the process of "unboxing" arguments and "boxing" returns... transforming them to and from Datums, specifically at function boundaries... sound. If your code has been broken, it either is a rare and specific SetOfIterator or TableIterator type or it was probably unsound, especially if it used the 'static
lifetime. Please report any unexpected breakages.
Fortunately, this has upsides beyond just soundness: now lifetimes in pgrx functions should simply work, and work correctly.
The PRs of interest:
- Implement
RetAbi
andBoxRet
by @workingjubilee in #1701 - Allow real borrow-checking of
#[pg_extern] fn
lifetimes by @workingjubilee in #1724 - Fix lifetimes for IO functions by @workingjubilee in #1733
- FcInfo wrapper by @NotGyro in #1720
- Make unboxing args sound with
ArgAbi
by @workingjubilee in #1731
Documentation improvements
If you use mdbook you can generate our documentation. Unfortunately it isn't published yet. We've been making various small improvements to it.
- inline lib reqs for
cargo pgrx init
by @jyn514 in #1630 - Document what happens with the
./sql
directory by @eeeebbbbrrrr in #1725 - document pg_guard to the best of my abilities by @eeeebbbbrrrr in #1729
Span adjustments for diagnostics/linting
A number of fixes have been done to how pgrx generates code so that the code should now be detectable as macro-expanded code while still pointing to the appropriate code in errors. There are still diagnostic improvements to be had and this is not done uniformly across all of pgrx yet, so please report if there are issues with these.
- Pipe forward spans by formatting idents by @workingjubilee in #1665
- Ad hoc span fixups by @workingjubilee in #1668
- Begin synthesizing spans by @workingjubilee in #1746
Deprecations
A number of things have been deprecated gracefully rather than simply unceremoniously dumped.
- Deprecate
set_varsize
by @workingjubilee in #1617 - Deprecate
variadic!
support by @workingjubilee in #1713 - C enums as module consts + deprecation by @workingjubilee in #1748
New Contributors
- @jyn514 made their first contribution in #1630
- @my-vegetable-has-exploded made their first contribution in #1655
- @staticle made their first contribution in #1656
- @theory made their first contribution in #1663
- @sardination made their first contribution in #1684
- @hamirmahal made their first contribution in #1717
Full Changelog: v0.12.0-alpha.1...v0.12.0-beta.0