SPI_FNUMBER(3)

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

🌸 NAME 🌸

okay so bestie, welcome to SPI_FNUMBER(3) from the PostgreSQL 13.23 documentation β€” this page is literally about finding the column number for a column name. The NAME tea is:

  • SPI_fnumber β€” determine the column number for the specified column name. periodt. πŸ’…

✨ 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, honestly. πŸŽ€

If colname refers to a system column (e.g., ctid), then the appropriate negative column number will be returned. plot twist!! 😭

The caller should be careful to test the return value for exact equality to SPI_ERROR_NOATTRIBUTE to detect an error; testing the result for less than or equal to 0 is not correct unless system columns should be rejected. like, do not be messy about this check, bestie. πŸ’€

πŸŽ€ ARGUMENTS πŸŽ€

  • TupleDesc rowdesc β€” input row description. the rowdesc in question, fr fr. 🫢
  • const char * colname β€” column name. the name we’re looking up. ✨

πŸ¦‹ RETURN VALUE πŸ¦‹

Column number (count starts at 1 for user-defined columns), or SPI_ERROR_NOATTRIBUTE if the named column was not found. that’s the whole vibe check. πŸ’–


mwah πŸ’‹ β€” this page is from PostgreSQL 13.23, dated 2025, and it’s the SPI_FNUMBER(3) manual page. slay and goodbye. πŸ‘‘πŸŒˆ

πŸ“¦ where this page comes from