SPI_REGISTER_RELATION(3pg14)

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

πŸ’… SPI_REGISTER_RELATION β€” bestie's guide to PostgreSQL 14.24 docs ✨

okay so picture this: it's a PostgreSQL 14.24 documentation page, it's SPI_REGISTER_RELATION(3), and it's literally about handing your SPI queries a named relation to play with. buckle up πŸŽ€


✨ NAME ✨

SPI_register_relation β€” makes an ephemeral named relation available by name inside SPI queries. it's giving "here, hold this" energy 🫢


🌸 SYNOPSIS 🌸

int SPI_register_relation(EphemeralNamedRelation enr)

πŸ¦‹ DESCRIPTION πŸ¦‹

so SPI_register_relation takes an ephemeral named relation (plus all its associated info, like, 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 whole vibe. it's the registry-entry-to-query-pipeline pipeline, and honestly? iconic. πŸ‘‘


πŸ’– ARGUMENTS πŸ’–

  • EphemeralNamedRelation enr β€” the ephemeral named relation registry entry. yes, that's the name. yes, it's a whole struct situation. she's the main character here.

πŸ”₯ RETURN VALUE πŸ”₯

if the command executed successfully, you get one of these nonnegative values back β€” slay:

  • SPI_OK_REL_REGISTER β€” returned when the relation has been successfully registered by name. we love a success story πŸ’œ

but if things go sideways, one of these negative values comes back instead β€” and ngl, they're all a little tragic 😭:

  • SPI_ERROR_ARGUMENT β€” enr is NULL, or its name field is NULL. literally nothing to work with bestie.
  • SPI_ERROR_UNCONNECTED β€” you called it from an unconnected C function. no connection, no service πŸ™ˆ
  • SPI_ERROR_REL_DUPLICATE β€” the name inside enr's name field is already registered for this connection. she's taken, the name has been claimed, pick another πŸ’€

⚠️ real talk: those negative returns aren't a suggestion, they're a vibe check β€” check your pointers and your connection before you come crying to me 🧚

and that's the page, periodt. 🌈 source and version: PostgreSQL 14.24, dated 2026, filed under SPI_REGISTER_RELATION(3) β€” mwah, go register something cute πŸ’…πŸ“

πŸ“¦ where this page comes from