SPI_GETTYPE(3)

πŸ“¦ version 15.19, in opensuse-leap 16.0

πŸ’– SPI_gettype β€” bestie edition πŸ’–

okay so this is the SPI_GETTYPE(3) page from the PostgreSQL 15.19 docs, and we're about to make data type names make sense. no cap. 🫢


✨ NAME ✨

SPI_gettype β€” return the data type name of the specified column. literally its whole job, and it ate. πŸ’…

🌸 SYNOPSIS 🌸

char * SPI_gettype(TupleDesc rowdesc, int colnumber)

πŸŽ€ DESCRIPTION πŸŽ€

SPI_gettype returns a copy of the data type name of the specified column. yup, a copy β€” main character behavior. (You can use pfree to release the copy of the name when you don't need it anymore.) so when you're done with that name copy, pfree it and move on. 🧚

πŸ¦‹ ARGUMENTS πŸ¦‹

  • TupleDesc rowdesc β€” input row description. it's giving β€œhere's the row info.”
  • int colnumber β€” column number (count starts at 1). yes bestie, the count starts at 1, not 0. πŸ”₯

πŸ‘‘ RETURN VALUE πŸ‘‘

The data type name of the specified column, or NULL on error. and on error, SPI_result is set to SPI_ERROR_NOATTRIBUTE. so if it's not giving a name, it's giving NULL plus that SPI_result value. 😭


mwah πŸ’‹ this iconic page is from PostgreSQL 15.19, dated 2026, and it's literally SPI_GETTYPE(3). periodt. πŸŽ€

πŸ“¦ where this page comes from