Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PL/Rust v1.2.0 is a brings a number of new features. It is backwards compatible with all existing
LANGUAGE plrust
functions, both the source and compiled forms.What's Changed
More Data Type Support
Date/Time/Interval
PL/Rust v1.2.0 now supports Postgres
date
,time
,time with time zone
,timestamp
,timestamp with time zone
, andinterval
types as both function arguments and return types.These types map to similarly named Rust types via
plrust-trusted-pgrx
and are fairly feature complete. Please see the data types documentation for their mappings.PL/Rust now exposes Postgres' various date/time construction functions such as
now()
,current_timestamp()
, and many more. They're documented in the plrust-trusted-pgx API documentation.Arrays as Slices
Function arguments which are arrays of primitive types (ie,
Array<i32 | i64 | f32 | f64>
) now have anas_slice()
method, providing direct read-only access to the array contents as a&[i32 | i64 | f32 | f64]
. This can greatly improve performance when iterating or doing random access with these types of arrays.The arrays chapter provides some examples.
Set Returning Functions
RETURNS TABLE (...)
functions by @eeeebbbbrrrr in SupportRETURNS TABLE (...)
functions #326PL/Rust now supports
RETURNS TABLE (...)
, allowingLANGUAGE plrust
functions to return wide rows of disparate data.A user function returns a
TableIterator
whose's item is a Rust tuple of values matching the data types declared in theRETURNS TABLE (...)
clause. PL/Rust takes care of the rest!User Defined Types Support
PL/Rust now supports working with composite types created in SQL via the
CREATE TABLE ... AS (...)
statement. These types can be used as both function arguments and return types. They can be constructed, by name, in PL/Rust functions, and have their attributes are accessible and mutable. This happened in PR #311.The documentation, with a detailed example is in the new UDTs chapter
Dependency Allow List Changes
The dependency allow-list has been redesigned to allow much more flexibility in defining dependencies, the specific versions (or version ranges) allowed, and any other dependency related properties such as features.
Remember that by default PL/Rust allows all 3rd party crates. It is recommended to configure an allow-list. The allow-list is documented here.
Lints
v1.2.0 adds another lint to guard against potential "I-Unsound" bugs in the Rust compiler and also does some cleanup along the way.
unaligned_references
lint (it's now a compiler error) by @eeeebbbbrrrr in Remove theunaligned_references
lint (issue #323) #328This last one (#327) allows existing compiled PL/Rust functions to be loaded by new PL/Rust versions that now have lints the previous version didn't.
Trusted Support on MacOS
PL/Rust v1.2.0 can now be used as a trusted language handler on MacOS!
Previous versions could be compiled/installed on MacOS but not in the trusted form. Most of the work for this happened by @thomcc in the
postgrestd
library.--features trusted
on macOS by @eeeebbbbrrrr in Support--features trusted
on macOS #334Operational Changes
PL/Rust now requires rust v1.70.0. In order to compile and install PL/Rust v1.2.0 you'll first need to update to exactly rust v1.70.0.
Project Management
Our CI is nearly 2x faster now and also includes testing on MacOS.
Upgrading
Upgrading to PL/Rust v1.2.0 is as simple as installing the new
plrust.so
. If you're using our pre-built .deb packages, simply install them withdpkg
and restart the Postgres cluster.If you've installed PL/Rust manually, simply follow that process again, making sure to compile the new
postgrestd
andplrustc
crates, both with Rust 1.70.0.Full Changelog: v1.1.3...v1.2.0