SPI_CONNECT(3)

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

🌸 NAME β€” SPI_CONNECT(3) 🌸

SPI_connect, SPI_connect_ext β€” connect a C function to the SPI manager πŸ’…

Okay bestie, manual-name moment: this is the PostgreSQL 13.23 Documentation page for SPI_CONNECT(3), folded in right at the top so we’re not copying that boring header line like it’s a PDF from 2009. 🫢

✨ SYNOPSIS ✨

int SPI_connect(void)

int SPI_connect_ext(int options)

πŸ¦‹ DESCRIPTION πŸ¦‹

SPI_connect opens a connection from a C function invocation to the SPI manager. You must call this function if you want to execute commands through SPI. A few utility SPI functions can still be called from unconnected C functions β€” lowkey convenient, no cap.

SPI_connect_ext does the same thing, but it has an argument that lets you pass option flags. Currently, the following option values are available:

  • SPI_OPT_NONATOMIC β€” sets the SPI connection to be nonatomic, which means transaction control calls (SPI_commit, SPI_rollback) are allowed. Otherwise, calling those functions will result in an immediate error. ⚠️ That β€œimmediate error” part is real, so don’t sleep on it.

Also, SPI_connect() is equivalent to SPI_connect_ext(0). Same energy, different signature. πŸ’«

πŸ‘‘ RETURN VALUE πŸ‘‘

  • SPI_OK_CONNECT β€” on success πŸŽ‰
  • SPI_ERROR_CONNECT β€” on error 😭

Made with πŸ’– for PostgreSQL 13.23, dated 2025, and filed under SPI_CONNECT(3) β€” bye bestie, go connect responsibly! πŸŽ€

πŸ“¦ where this page comes from