SPI_GETTYPEID(3)
π NAME π
SPI_gettypeid β bestie, this one hands you the data type OID of whatever column you point at. that's it, that's the whole job β¨
π SYNOPSIS π
Oid SPI_gettypeid(TupleDesc rowdesc, int colnumber)
π¦ DESCRIPTION π¦
okay so picture this: you're deep in server-side C, you've got a row description in your hands, and you just need to know what type one specific column is. not the value. not the name. the type OID.
that's literally what SPI_gettypeid is for π
it returns the OID of the data type of the column you asked about.
no cap, that's the entire vibe. small function, big main character energy. π
πΈ ARGUMENTS πΈ
TupleDesc rowdescβ your input row description. the thing describing the row you're snooping through π΅οΈβοΈint colnumberβ the column number. and heads up bestie, the count starts at 1, not 0. so the first column is1, not0. do not come for me about it, that's just how it is π
β RETURN VALUE β
you get back the OID of the data type of the specified column. iconic. gorgeous. exactly what you asked for π«Ά
but β if something goes wrong, you get InvalidOid instead. and when that happens, SPI_result gets set to SPI_ERROR_NOATTRIBUTE so you actually know why it fumbled. it's giving "sorry babe, that column doesn't exist" π
lowkey always check your return value, bestie. InvalidOid is not a vibe you wanna miss. π
π SEE ALSO... jk, just the sign-off π
that's the whole page, bestie β you ate it up fr fr π this one's from the PostgreSQL 18.6 docs, dated 2026, and it's SPI_GETTYPEID(3). go forth and OID responsibly πβ¨π
π¦ where this page comes from
- alpine 3.23: postgresql18-doc 18.6-r0 Β· PostgreSQL
- alpine 3.24: postgresql18-doc 18.6-r0 Β· PostgreSQL
- arch rolling: postgresql 18.6-4 Β· PostgreSQL
- fedora 43: postgresql-server-devel 18.6-1.fc43 Β· PostgreSQL
- fedora 43: postgresql-server-devel 18.6-1.fc43 Β· PostgreSQL
- fedora 44: postgresql-server-devel 18.6-1.fc44 Β· PostgreSQL
- fedora 44: postgresql-server-devel 18.6-1.fc44 Β· PostgreSQL
- nixos 26.05: postgresql 18.6
- ubuntu resolute: postgresql-doc-18 18.6-0ubuntu0.26.04.1 Β· PostgreSQL
- ubuntu stonking: postgresql-doc-18 18.6-3build2 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms