tcdi / plrust

A Rust procedural language handler for PostgreSQL
PostgreSQL License
1.12k stars 32 forks source link

Function Capabilities & Zero Copy Arrays #298

Closed eeeebbbbrrrr closed 1 year ago

eeeebbbbrrrr commented 1 year ago

Adds a capabilities property to our pg_proc.prosrc json structure and defines an enum of known function capabilities, which right now only contains ZeroCopyArrays.

If a function is re-compiled (really only via a pg_restore) then we'll use the set of old capabilities and adjust the wrapper code accordingly.

New functions get the ZeroCopyArrays capability by default, which uses pgrx::Array<'a, T> instead of Vec<T>, which old functions would have been using.

Also adds pgrx::Array and friends to plrust-trusted-pgrx.

BradyBonnette commented 1 year ago

Reviewed after merge 👍