pgcentralfoundation / pgrx

Build Postgres Extensions with Rust!
Other
3.7k stars 249 forks source link

TableIterator no longer generates columns #1904

Closed ccleve closed 1 month ago

ccleve commented 1 month ago

This code from the documentation for TableIterator:

use pgrx::prelude::*;

#[pg_extern]
fn employees() -> TableIterator<
    'static,
    (
        name!(id, i64),
        name!(dept_code, String),
        name!(full_text, &'static str),
    ),
> {
    TableIterator::new(vec![
        (42, "ARQ".into(), "John Hammond"),
        (87, "EGA".into(), "Mary Kinson"),
        (3, "BLA".into(), "Perry Johnson"),
    ])
}

produces this output:

select rdb.employees();
        employees        
-------------------------
 (42,ARQ,"John Hammond")
 (87,EGA,"Mary Kinson")
 (3,BLA,"Perry Johnson")
(3 rows)

No nice neat columns any more. Both 12.4 and 12.5 have this problem. I'll check earlier versions if you need me to.

workingjubilee commented 1 month ago

Huh. Odd. Do you happen to have what it looked like before on-hand?

workingjubilee commented 1 month ago

It looked like this right?

id dept_code full_text
42 ARQ John Hammond
87 EGA Mary Kinson
3 BLA Perry Johnson
SteveLauC commented 1 month ago

It looked like this right?

Right, it should have multiple columns if the returned tuple has multiple elements.

ccleve commented 1 month ago

Never mind. I was calling select employees() instead of select * from employees(). Not the first time I have made that mistake. Sorry.

eeeebbbbrrrr commented 1 month ago

@ccleve take a break man!