SPI_GETTYPE(3)
π 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
- opensuse-leap 16.0: postgresql15-docs 15.19-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms