SPI_CONNECT(3)

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

✨ SPI_CONNECT(3) ✨

okay so bestie, welcome to the manual page for SPI_connect and SPI_connect_ext β€” this is part of the PostgreSQL 14.24 docs, and honestly it's giving "small page, big main character energy" 🫢 because literally nothing in SPI happens until you call this. So like, pay attention bestie πŸ’…


🌸 NAME 🌸

SPI_connect, SPI_connect_ext β€” the way you connect a C function to the SPI manager ✨


πŸŽ€ SYNOPSIS πŸŽ€

int SPI_connect(void)

int SPI_connect_ext(int options)

πŸ¦‹ DESCRIPTION πŸ¦‹

so SPI_connect opens a connection from a C function invocation over to the SPI manager. That's it, that's the whole vibe πŸ’«

You must call this function if you want to execute commands through SPI. Like, you literally cannot skip it, it's not optional, it's not a "maybe later" situation πŸ™ˆ

ngl there's one little exception that ate: some utility SPI functions can be called from unconnected C functions. So not literally everything needs the connection. But the command-executing stuff? yeah, you need it. periodt.

Then we have SPI_connect_ext β€” it does the exact same thing but it's got an argument so you can pass option flags through, which is lowkey the cooler sibling 😌 Currently, these are the option values that are available:

  • SPI_OPT_NONATOMIC β€” sets the SPI connection to be nonatomic, which means transaction control calls (SPI_commit, SPI_rollback) are allowed to happen. If you don't set this, then calling those functions will result in an immediate error. like, instant. no warning, just error πŸ’€

And the iconic little equivalency, bestie β€” memorize this one:

SPI_connect() is equivalent to SPI_connect_ext(0)

like, literally the exact same thing. SPI_connect is just the zero-flags girlie ✨


πŸ”₯ RETURN VALUE πŸ”₯

  • SPI_OK_CONNECT β€” on success πŸŽ‰ slay, you're connected
  • SPI_ERROR_CONNECT β€” on error 😭 something went wrong

and that's the page!! 🌈 cute, short, and every single fact survived intact, iykyk πŸ’œ this was PostgreSQL 14.24 documentation, dated 2026 β€” go forth and connect responsibly πŸ§šβ€β™€οΈβ­

πŸ“¦ where this page comes from