Crate pgrx_macros

Source

Macros§

extension_sql
Declare SQL to be included in generated extension script.
extension_sql_file
Declare SQL (from a file) to be included in generated extension script.

Attribute Macros§

commutator
Used with #[pg_operator]. 1 value which is the function name
hashes
Used with #[pg_operator]. no values
initialize
Associated macro for #[pg_test] to provide context back to your test framework to indicate that the test system is being initialized
join
Used with #[pg_operator]. 1 value which is the function name
merges
Used with #[pg_operator]. no values
negator
Used with #[pg_operator]. 1 value which is the function name
opname
Used with #[pg_operator]. 1 value which is the operator name itself
pg_aggregate
Declare a pgrx::Aggregate implementation on a type as able to used by Postgres as an aggregate.
pg_cast
Declare a function as #[pg_cast] to indicate that it represents a Postgres cast.
pg_extern
Declare a function as #[pg_extern] to indicate that it can be used by Postgres as a UDF.
pg_guard
Declare a function as #[pg_guard] to indicate that it is called from a Postgres extern "C-unwind" function so that Rust panic!()s (and Postgres elog(ERROR)s) will be properly handled by pgrx
pg_operator
Declare a function as #[pg_operator] to indicate that it represents a Postgres operator cargo pgrx schema will automatically generate the underlying SQL
pg_schema
Declare a Rust module and its contents to be in a schema.
pg_test
#[pg_test] functions are test functions (akin to #[test]), but they run in-process inside Postgres during cargo pgrx test.
pg_trigger
Create a PostgreSQL trigger function
pgrx
A helper attribute for various contexts.
restrict
Used with #[pg_operator]. 1 value which is the function name
search_path
Associated macro for #[pg_extern] or #[macro@pg_operator]. Used to set the SEARCH_PATH option on the CREATE FUNCTION statement.

Derive Macros§

AggregateName
Derives the ToAggregateName trait.
PostgresEnum
Generate necessary bindings for using the enum with PostgreSQL.
PostgresEq
Generate necessary code using the type in operators like == and !=.
PostgresGucEnum
Derives the GucEnum trait, so that normal Rust enums can be used as a GUC.
PostgresHash
Generate necessary code for stable hashing the type so it can be used with USING hash indexes.
PostgresOrd
Generate necessary code using the type in operators like >, <, <=, and >=.
PostgresType
Generate necessary bindings for using the type with PostgreSQL.