Macro pgrx::name

source ·
macro_rules! name {
    ($name:tt, $ty:ty) => { ... };
}
Expand description

A macro for providing SQL names for the returned fields for functions that return a Rust tuple, especially those that return a TableIterator.

§Examples

This example will create a SQL function like so:

CREATE FUNCTION get_a_set() RETURNS TABLE (id integer, title text) ...;
use pgrx::prelude::*;

#[pg_extern]
fn get_a_set() -> TableIterator<'static, (name!(id, i32), name!(title, &'static str))> {
    TableIterator::new(vec![1, 2, 3].into_iter().zip(vec!["A", "B", "C"].into_iter()))
}