SPI_REGI...GGER_DATA(3)

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

πŸ’– NAME πŸ’–

okay bestie, welcome to the SPI_REGI...GGER_DATA(3) page from the PostgreSQL 13.23 Documentation ✨ β€” the function here is SPI_register_trigger_data, and its whole vibe is making ephemeral trigger data available in SPI queries. periodt.

✨ SYNOPSIS ✨

int SPI_register_trigger_data(TriggerData *tdata)

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea: SPI_register_trigger_data makes any ephemeral relations captured by a trigger available to queries planned and executed through the current SPI connection. Currently, this means the transition tables captured by an AFTER trigger defined with a REFERENCING OLD/NEW TABLE AS ... clause. no cap.

This function should be called by a PL trigger handler function after connecting. literally 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. yay, iconic ✨

on error, one of the following negative values is returned instead β€” not the cute vibes:

  • SPI_ERROR_ARGUMENT β€” if tdata is NULL. bestie, that's not the move πŸ™ˆ
  • 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.

that's the whole page, bestie 🫢 this one is from PostgreSQL 13.23, dated 2025. go register that trigger data and slay πŸ’–βœ¨

πŸ“¦ where this page comes from