SPI_FNAME(3)
β¨ SPI_FNAME β¨
okay bestie, so this is the PostgreSQL 18.6 docs page for SPI_fname, and it's literally one of those tiny little functions that does exactly one thing and does it gorgeously π
π NAME π
SPI_fname β she tells you the column name for the column number you asked about. that's it. that's the whole job. icon behavior π
πΈ SYNOPSIS πΈ
char * SPI_fname(TupleDesc rowdesc, int colnumber)
π DESCRIPTION π
so SPI_fname gives you back a copy of the column name of the column you specified. not a pointer into the original, a whole fresh copy, she's generous like that π«Ά
and because it's a copy, you can use pfree to release it once you don't need the name anymore. pls do that. don't just leave her hanging in memory forever, that's not the vibe π
π¦ ARGUMENTS π¦
TupleDesc rowdescβ the input row description. your little map of what's in the row πΊοΈint colnumberβ the column number. and heads up bestie: the count starts at 1, not 0. no zero-indexing here, we're not doing that today β¨
β RETURN VALUE β
you get the column name back, slay. but if colnumber is out of range, you get NULL β no name for you π
and on error, SPI_result gets set to SPI_ERROR_NOATTRIBUTE. so like, always check, okay? don't just assume she came through π₯Ί
π reminder: it's a copy, so pfree it when you're done. main character energy means cleaning up after yourself π
and that's the whole page, no notes. this is from the PostgreSQL 18.6 documentation, dated 2026, and it's the SPI_FNAME(3) page β catch you in the next one, mwah ππβ¨
π¦ 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