Subject: What is the story behind _SPI_PLAN_MAGIC?

From: Marcelo Fernandes <[email-masked]>
Date: Mon, 3 Feb 2025 14:36:13 +1300

Hi there,

Reading through the SPI code I see this definition:

  #define _SPI_PLAN_MAGIC 569278163

Which is used in he _SPI_plan struct in src/include/executor/spi_priv.h:

  typedef struct _SPI_plan
  {
      int magic;
      ...
  }

What is its purpose?

Thank you.
Marcelo

---

From: Tom Lane <[email-masked]>
Date: Sun, 02 Feb 2025 21:17:03 -0500

>   #define _SPI_PLAN_MAGIC 569278163

Just to catch programming errors, ie passing the wrong pointer
value to some SPI function.  See the checks for it in spi.c.

			regards, tom lane