[−][src]Macro pgx::default
A macro for specifying default argument values so they get propery translated to SQL in
CREATE FUNCTION
statements
Examples
This example will create a SQL function like so:
CREATE OR REPLACE FUNCTION fun_with_default_arg_value(a integer, b integer DEFAULT 99) RETURNS integer ...;
use crate::pgx::*; #[pg_extern] fn fun_with_default_arg_value(a: i32, b: default!(i32, 99)) -> i32 { a + b }
This allows users of this function, from within Postgres, to elide the b
argument, and
Postgres will automatically use 99
.