SPI_REGISTER_RELATION(3)

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

πŸ’« SPI_REGISTER_RELATION πŸ’«

okay bestie, so this is a PostgreSQL 18.6 Documentation page, manual section 3, and it's literally all about making a lil ephemeral named relation show up by name inside your SPI queries. yes queen, we're doing C-level server programming today πŸŽ€


✨ NAME ✨

SPI_register_relation β€” make an ephemeral named relation available by name in SPI queries πŸ¦‹


✨ SYNOPSIS ✨

int SPI_register_relation(EphemeralNamedRelation enr)

✨ DESCRIPTION ✨

so SPI_register_relation takes an ephemeral named relation (plus all its associated info, the whole package πŸ’…) and makes it available to queries that get planned and executed through the current SPI connection. that's it, that's the vibe. it's giving "here's my relation, pls let my queries see it" ✨


✨ ARGUMENTS ✨

  • EphemeralNamedRelation enr β€” the ephemeral named relation registry entry. the actual receipt, the entry, the whole thing 🧚

✨ RETURN VALUE ✨

if the command executed successfully, you get back a nonnegative value, and it's one of these:

  • SPI_OK_REL_REGISTER β€” the relation got successfully registered by name. slay πŸ‘‘

and if something went wrong? you get one of these negative values instead 😭:

  • SPI_ERROR_ARGUMENT β€” triggered if enr is NULL, or if its name field is NULL. like, you gotta give it something, bestie πŸ™ˆ
  • SPI_ERROR_UNCONNECTED β€” triggered if this gets called from an unconnected C function. no connection, no service πŸ’€
  • SPI_ERROR_REL_DUPLICATE β€” triggered if the name in the name field of enr is already registered for this connection. girl, that name is TAKEN 🚫

fr fr, those error values matter β€” check them. don't just vibe and assume it worked ✨

and that's the whole page, no cap. every flag, every return value, every error, all accounted for πŸ’œ

this was the SPI_REGISTER_RELATION(3) page from PostgreSQL 18.6, dated 2026 β€” mwah, tysm for reading, ily, go register some relations 🫢🌸

πŸ“¦ where this page comes from