Attribute Macro pgx::pg_schema

source ·
#[pg_schema]
Expand description

Declare a Rust module and its contents to be in a schema.

The schema name will always be the mod’s identifier. So mod flop will create a flop schema.

If there is a schema inside a schema, the most specific schema is chosen.

In this example, the created example function is in the dsl_filters schema.

use pgx::*;

#[pg_schema]
mod dsl {
    use pgx::*;
    #[pg_schema]
    mod dsl_filters {
        use pgx::*;
        #[pg_extern]
        fn example() { todo!() }
    }
}

File modules (like mod name;) aren’t able to be supported due to rust/#54725.