SPI_FNUMBER(3)
π SPI_FNUMBER(3) β the column-number bestie π
okay so you're in the PostgreSQL 14.24 Documentation era and you need to figure out which column number matches a column name? say less, bestie. this page has you covered, no cap. β¨
πΈ NAME πΈ
SPI_fnumber β determine the column number for the specified column name.
π¦ SYNOPSIS π¦
int SPI_fnumber(TupleDesc rowdesc, const char * colname)
π DESCRIPTION π
SPI_fnumber returns the column number for the column with the specified name. iconic behavior, literally.
if colname refers to a system column (e.g., ctid) then the appropriate negative column number will be returned. yes, negative β system columns stay main-character. π«Ά
β οΈ okay this part matters: the caller should be careful to test the return value for exact equality toSPI_ERROR_NOATTRIBUTEto detect an error. testing the result for less than or equal to0is not correct unless system columns should be rejected. do not do the lazy<= 0check unless you mean it, bestie π
π ARGUMENTS π
TupleDesc rowdescβ input row description.const char * colnameβ column name.
β¨ RETURN VALUE β¨
column number (count starts at 1 for user-defined columns), or SPI_ERROR_NOATTRIBUTE if the named column was not found. slay. π
mwah π β signed, sealed, and served by the PostgreSQL 14.24 docs, dated 2026, page SPI_FNUMBER(3). periodt. π
π¦ where this page comes from
- opensuse-leap 16.0: postgresql14-docs 14.24-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