SPI_REGI...GGER_DATA(3)

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

🌸 NAME 🌸

okay so bestie, this is the SPI_REGI...GGER_DATA(3) page β€” yes, the truncated name is giving main-character energy, iykyk β€” and the function we’re hyping is SPI_register_trigger_data. it makes ephemeral trigger data available in SPI queries. periodt. ✨

✨ SYNOPSIS ✨

int SPI_register_trigger_data(TriggerData *tdata)

πŸ’… DESCRIPTION πŸ’…

so SPI_register_trigger_data makes any ephemeral relations captured by a trigger available to queries planned and executed through the current SPI connection. no cap. πŸ¦‹

currently, this means the transition tables captured by an AFTER trigger defined with a REFERENCING OLD/NEW TABLE AS ... clause. that’s the specific vibe rn.

this function should be called by a PL trigger handler function after connecting. like, connect first, then call it β€” that’s the assignment, bestie. πŸ’–

πŸŽ€ ARGUMENTS πŸŽ€

  • TriggerData *tdata β€” the TriggerData object passed to a trigger handler function as fcinfo->context. that’s the one you hand over. 🫢

πŸ’– RETURN VALUE πŸ’–

if the execution of the command was successful, then the following (nonnegative) value will be returned:

  • SPI_OK_TD_REGISTER β€” if the captured trigger data (if any) has been successfully registered. slay, it worked. πŸ’…

on error, one of the following negative values is returned:

  • SPI_ERROR_ARGUMENT β€” if tdata is NULL
  • SPI_ERROR_UNCONNECTED β€” if called from an unconnected C function
  • SPI_ERROR_REL_DUPLICATE β€” if the name of any trigger data transient relation is already registered for this connection
bestie, those error returns are negative values β€” not the vibe we want, but now you know exactly what they mean. 😭

mwah πŸ’‹ that’s the whole page, from the PostgreSQL 16.15 documentation, dated 2026 β€” catch u at the bottom of the man page, bestie πŸ«ΆπŸ‘‘

πŸ“¦ where this page comes from