SPI_REGI...GGER_DATA(3)

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

πŸ’– SPI_register_trigger_data β€” the manual page bestie edition πŸ’–

okay so this is SPI_register_trigger_data(3), straight outta the PostgreSQL 18.6 Documentation bestie. yes the real manual name is that long. we're doing this together, grab a snack πŸ“


✨ NAME ✨

SPI_register_trigger_data β€” makes ephemeral trigger data available in SPI queries πŸ¦‹


✨ SYNOPSIS ✨

int SPI_register_trigger_data(TriggerData *tdata)

✨ DESCRIPTION ✨

okay so here's the vibe: SPI_register_trigger_data takes any ephemeral relations that a trigger captured and makes them available to queries that get planned and executed through the current SPI connection. πŸ’…

rn, "ephemeral relations" means the transition tables captured by an AFTER trigger that was defined with a REFERENCING OLD/NEW TABLE AS ... clause. that's it, that's the whole list, no cap.

the way this works: this function should be called by a PL trigger handler function after connecting. don't skip the connecting part bestie, it's literally in the instructions 😭

✨ ARGUMENTS ✨

  • TriggerData *tdata β€” the TriggerData object that gets passed to a trigger handler function as fcinfo->context. that's your whole argument, one single icon πŸ‘‘

✨ RETURN VALUE ✨

if the execution of the command went well, you get this nonnegative value back:

  • SPI_OK_TD_REGISTER β€” if the captured trigger data (if any) has been successfully registered ✨

and if it goes wrong, one of these negative values comes back at you instead:

  • SPI_ERROR_ARGUMENT β€” if tdata is NULL πŸ’€
  • SPI_ERROR_UNCONNECTED β€” if it was 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 😭

and that's the whole page bestie, every flag, every error code, every vibe, nothing left behind 🫢

this has been your girl signing off from PostgreSQL 18.6, dated 2026, page SPI_register_trigger_data(3) β€” go forth and register that trigger data, you absolute main character πŸ‘‘πŸ’–βœ¨

πŸ“¦ where this page comes from