Skip to content

Allow a type alias for TableIterator in #[pg_extern]. #2067

@if0ne

Description

@if0ne

Code:

pub type Output = TableIterator<'static, (name!(bar, String), name!(baz, i32))>;

#[pg_extern]
pub fn test(foo: String) -> Output {
    Output::empty()
}

Run cargo run pgrx

Error:

thread 'main' panicked at /tmp/.tmpp9lY5M:1:12155:
Could not write SQL to /home/pagafonov/.pgrx/13.20/pgrx-install/share/postgresql/extension/pgnats--0.1.0.sql: Got non-plain mapped/composite return variant SQL in what macro-expansion thought was a type, got: Table([As("TEXT"), As("INT")])

Stacktrace:

Location:
    /home/pagafonov/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/pgrx-sql-entity-graph-0.14.1/src/pg_extern/entity/mod.rs:185:45
stack backtrace:
   0: rust_begin_unwind
             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/panicking.rs:695:5
   1: core::panicking::panic_fmt
             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/core/src/panicking.rs:75:14
   2: core::result::unwrap_failed
             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/core/src/result.rs:1704:5
   3: core::result::Result<T,E>::expect
             at /home/pagafonov/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/result.rs:1061:23
   4: pgrx_embed_pgnats::pgrx_embed::main
             at /tmp/.tmpp9lY5M:1:12044
   5: core::ops::function::FnOnce::call_once
             at /home/pagafonov/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions