Expand description

plrust-trusted-pgrx is a re-export crate based on pgrx which exposes the minimal set of pgrx internals necessary for plrust function compilation. plrust-trusted-pgrx also includes a number of Rust types for interoperating with Postgres types, access to Postgres’ “SPI”, logging, and trigger support.



  • Safe Rust wrappers for various Postgres types.
  • Support for arbitrary composite types as a “heap tuple”.
  • Return iterators from plrust functions
  • Lower-level Postgres internals, which are safe to use.
  • Use all the things.
  • Use Postgres’ Server Programming Interface to execute arbitrary SQL.
  • Various types for use when a plrust function is a trigger function.


  • Log to Postgres’ debug1 log level.
  • Log to Postgres’ debug2 log level.
  • Log to Postgres’ debug3 log level.
  • Log to Postgres’ debug4 log level.
  • Log to Postgres’ debug5 log level.
  • Sends some kind of message to Postgres, and if it’s a PgLogLevel::ERROR or greater, Postgres’ error handling takes over and, in the case of PgLogLevel::ERROR, aborts the current transaction.
  • Log to Postgres’ error log level. This will abort the current Postgres transaction.
  • Log to Postgres’ info log level.
  • Log to Postgres’ log log level.
  • Log to Postgres’ notice log level.
  • Log to Postgres’ warning log level.




  • Indicates that something can be reported as a Postgres ERROR, if that’s what it might represent.
  • Augments types that can be used as fn_call arguments. This is only implemented for the Arg enum.


  • Dynamically call a named function in the current database. The function must be one previously defined by CREATE FUNCTION. Its underlying LANGUAGE is irrelevant – call LANGUAGE sql, LANGUAGE plpgsql, LANGUAGE plperl, or (our favorite) LANGUAGE plrust functions.