SPI_GETBINVAL(3)

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

✨ NAME ✨

SPI_getbinval β€” return the binary value of the specified column, bestie. This is the SPI_GETBINVAL(3) page and it's literally giving β€œI know exactly which column I want.” πŸ’…


🌸 SYNOPSIS 🌸

Datum SPI_getbinval(HeapTuple row, TupleDesc rowdesc, int colnumber,
                    bool * isnull)

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so SPI_getbinval returns the value of the specified column in the internal form, as type Datum. No cap. It's that simple and that iconic. ✨

This function does not allocate new space for the datum. Zero new allocation, zero drama. In the case of a pass-by-reference data type, the return value will be a pointer into the passed row. So yeah, it's pointing back at the row you gave it β€” keep that in mind, bestie. 🫢


πŸŽ€ ARGUMENTS πŸŽ€

  • HeapTuple row β€” the input row to be examined. Like, the row you're investigating. πŸ”
  • TupleDesc rowdesc β€” the input row description. The little map of what's in the row. πŸ—ΊοΈ
  • int colnumber β€” column number, and the count starts at 1. Not zero. One. Periodt. πŸ’…
  • bool * isnull β€” flag for a null value in the column. It's the β€œis this column null?” receipt. 🧾

πŸ‘‘ RETURN VALUE πŸ‘‘

The binary value of the column is returned. The variable pointed to by isnull is set to true if the column is null, else to false. So you get the value and the null check, all in one glorious little operation. 🌈

SPI_result is set to SPI_ERROR_NOATTRIBUTE on error. That's the error vibe check, iykyk. πŸ’€


🫢 Cute little sign-off: this page is from PostgreSQL 14.24 Documentation, dated 2026, and it's serving SPI_GETBINVAL(3) energy. Mwah. πŸ’‹
πŸ“¦ where this page comes from