Update PL/Rust

This section explains how to update PL/Rust installations. This assumes you installed PL/Rust following our installation guide and pgrx and PL/Rust are installed using the postgres Linux user.

Update pgrx

A PL/Rust update is often accompanied by an update of the underlying pgrx project. Install the latest version of pgrx. Changing into the plrust folder ensures the rustc version used for installation is the same required by PL/Rust.

Start as a user with sudo access.

sudo chown postgres -R /usr/share/postgresql/15/extension/
sudo chown postgres -R /usr/lib/postgresql/15/lib/
sudo su - postgres
cd ~/plrust
git pull
cargo install cargo-pgrx --locked

Update PL/Rust

Follow these steps to upgrade PL/Rust from GitLab to use the latest release.

Update plrustc, postgrestd and plrust installations.

cd ~/plrust/plrustc
./build.sh
mv ~/plrust/build/bin/plrustc ~/.cargo/bin/

cd ~/plrust/plrust
PG_VER=15 \
    STD_TARGETS="x86_64-postgres-linux-gnu " \
    ./build

cargo pgrx install --release \
    --features trusted \
    -c /usr/bin/pg_config

Exit out of postgres user back to user with sudo.

exit

Restart Postgres, required b/c plrust is in shared_preload_libraries. Set permissions back to default.

sudo systemctl restart postgresql

sudo chown root -R /usr/share/postgresql/15/extension/
sudo chown root -R /usr/lib/postgresql/15/lib/

Rust versions

See the section(s) about Rust versions the the Install PL/Rust section. Pay special attention to the versions defined by PL/Rust, and your system defaults for rustc and rustup.