SPI_REGISTER_RELATION(3pg14)
π 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βenrisNULL, or itsnamefield isNULL. 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 insideenr'snamefield 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
- opensuse-leap 16.0: postgresql14-docs 14.24-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms