Skip to content

Releases: tcdi/plrust

v1.2.8

07 Mar 18:36
bd76906
Compare
Choose a tag to compare

Welcome to PL/Rust v1.2.8. This release contains zero code changes from v1.2.7. It's just being tagged again to address some bitrot in our CI pipelines.

If you're already using v1.2.7, there's no need to upgrade.

What's Changed

Full Changelog: v1.2.7...v1.2.8

v1.2.7

18 Nov 16:47
Compare
Choose a tag to compare

Welcome to PL/Rust v1.2.7. This is a small feature release that adds the ability to call user defined functions (UDFs) from a LANGUAGE plrust function.

As a contrived example, perhaps your database has a LANGUAGE sql function like:

CREATE OR REPLACE FUNCTION sum_array(a int[]) RETURNS int STRICT LANGUAGE sql AS $$ 
    SELECT sum(e) FROM unnest(a) e 
$$;

And you wish to call it from a PL/Rust function. Well, now you can!

CREATE OR REPLACE FUNCTION transform_array(a int[]) RETURNS int STRICT LANGUAGE plrust AS $$
    // add one to every element of `a`, the input argument array, collecting into a new Vec
    let a = a.into_iter().map(|e| e.unwrap_or(0) + 1).collect::<Vec<_>>();  

    // call the existing "sum_array(int[])" function to sum the values of `a`
    Ok(fn_call("sum_array", &[&Arg::Value(a)])?)
$$;

SELECT transform_array(ARRAY[1,2,3]);
transform_array 
-----------------
               9
(1 row)

PL/Rust's dynamic function call API is documented in the book.

Other than also upgrading the underlying pgrx dependency to v0.11.0, there have been no other changes to PL/Rust since v1.2.6.

This release took quite a bit longer than expected as we had a desire to upgrade it to work with Rust v1.73.0. Unfortunately, rustc v1.73.0 introduced a bug around custom lints and it took our team weeks to track this down and ultimately provide the Rust project a PR. Based on Rust's release schedule, that fix won't be released until v1.75.0.

That's a long way of saying that PL/Rust v1.2.7 still requires Rust v1.72.0.

A Note on Postgres 16 Support

Postgres 16 has added some "SIMD" code, and includes the compiler built-in header for SIMD support. This can cause compilation problems with pgrx if the host system has multiple clang versions installed. It's suggested a machine running PL/Rust only have one clang version and the matching llvm packages installed. It doesn't seem to matter which version, only that there's one.

Notable Changes

Full Changelog: v1.2.6...v1.2.7

v1.2.6

14 Sep 21:05
Compare
Choose a tag to compare

This is PL/Rust v1.2.6. It provides support for Postgres v16.

What's Changed

  • bump to v1.2.6 and update pgrx to v0.10.1 which provides pg16 support by @eeeebbbbrrrr in #383

Project-related Changes

Full Changelog: v1.2.5...v1.2.6

v1.2.5

06 Sep 17:13
2eaa9ee
Compare
Choose a tag to compare

Welcome to PL/Rust v1.2.5. It is a minor bugfix and feature release.

Important Changes

Extension Schema Change

The PL/Rust schema version has bumped to 1.1. As such, an ALTER EXTENSION plrust UPDATE; will be required for all databases with PL/Rust.

Rust Requirements

PL/Rust v1.2.5 requires Rust v1.72.0. The previous version required Rust v1.70.0

Postgres 16RC1 Support

PL/Rust v1.2.5 now supports Postgres 16RC1. Note that we are not releasing binary artifacts for pg16 until it goes gold.

Other Changes

Public-facing Changes

  • Add a function to list all the allowlisted crates with their respecti… by @anth0nyleung in #373
  • Change plrust.allowed_dependencies to sighup context by @anth0nyleung in #362
  • Bump to Rust 1.72.0, and remove plrust_tuple_struct_self_pattern lint. by @thomcc in #375

Bugfixes and Cleanup

Project Related

New Contributors

Thanks to the new contributors. Always nice to see input from community members!

Full Changelog: v1.2.3...v1.2.4

v1.2.3

11 Jul 15:57
Compare
Choose a tag to compare

Welcome to PL/Rust v1.2.3. It is a minor bugfix release fixing some issues with its set of lints along with compilation of external crate dependencies.

What's Changed

  • Use typeck_results.node_type to resolve the type in suspicious trait object lint (#349) by @thomcc in #351
  • Use typeck_results.node_type to resolve the type in suspicious trait object lint by @thomcc in #349
  • Add a lint for closure trait impls by @thomcc in #346

NOTE: This release was re-released as of ce70004 to update the plrust/build script.

Full Changelog: v1.2.2...v1.2.3

v1.2.2

29 Jun 23:30
07bec8d
Compare
Choose a tag to compare

This is PL/Rust v1.2.2. It is a minor release that fixes a likely crashing bug when arrays of "varlena" types (text, varchar) are a) used as function arguments, b) iterated, and c) contain at least one leading NULL element.

It is highly suggested that users upgrade to v1.2.2.

What's Changed

Full Changelog: v1.2.1...v1.2.2

v1.2.1

21 Jun 00:37
Compare
Choose a tag to compare

This is PL/Rust v1.2.1. It is a minor patch release bringing in new upstream dependencies. Specifically, pgrx v0.9.6 which fixes a bug with Datum to Date conversions.

What's Changed

Full Changelog: v1.2.0...v1.2.1

v1.2.0

14 Jun 15:44
Compare
Choose a tag to compare

PL/Rust v1.2.0 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, and interval 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 an as_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

PL/Rust now supports RETURNS TABLE (...), allowing LANGUAGE 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 the RETURNS 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.

  • Add a lint for the Self tuple struct soundness hole by @thomcc in #320
  • Fully resolve aliases in plrust-suspicious-trait-object by @thomcc in #335
  • Remove the unaligned_references lint (it's now a compiler error) by @eeeebbbbrrrr in #328
  • Improve plrustc lint messages by @thomcc in #333
  • Don't require a loaded function to have "compile lints" applied. by @eeeebbbbrrrr in #327

This 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.

Operational 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 with dpkg and restart the Postgres cluster.

If you've installed PL/Rust manually, simply follow that process again, making sure to compile the new postgrestd and plrustc crates, both with Rust 1.70.0.

Full Changelog: v1.1.3...v1.2.0

v1.1.3

24 May 23:13
39be052
Compare
Choose a tag to compare

Welcome to PL/Rust v1.1.3. This release fixes a performance regression using functions with ARRAY arguments.

It also no longer compiles UDFs with debug-assertions. This was, unfortunately, a development-only change that found its way into previously released versions.

While not required, it may be desirable to CREATE OR REPLACE any existing LANGUAGE plrust functions in order to take advantage of these performance improvements.

What's Changed

New Contributors

Full Changelog: v1.1.2...v1.1.3

v1.1.2

09 May 18:24
528d303
Compare
Choose a tag to compare

This is PL/Rust v1.1.2. It contains no functional changes. Only changes to dependencies along with new CI integrations to automatically publish .deb artifacts when we cut a new release.

What's Changed

Full Changelog: v1.1.1...v1.1.2