Change InitToastSnapshot to a macro.
authorRobert Haas
Fri, 5 Aug 2016 15:57:00 +0000 (11:57 -0400)
committerRobert Haas
Fri, 5 Aug 2016 15:58:03 +0000 (11:58 -0400)
tqual.h is included in some front-end compiles, and a static inline
breaks on buildfarm member castoroides.  Since the macro is never
referenced, it should dodge that problem, although this doesn't
seem like the cleanest way of hiding things from front-end compiles.

Report and review by Tom Lane; patch by me.

src/backend/access/heap/tuptoaster.c
src/include/utils/tqual.h

index 55b6b41f8c7fe9068000e660582de29c2837ed5b..31b0132b4223cca4c7050dce43ea842d14f515ba 100644 (file)
@@ -2316,5 +2316,5 @@ init_toast_snapshot(Snapshot toast_snapshot)
    if (snapshot == NULL)
        elog(ERROR, "no known snapshots");
 
-   InitToastSnapshot(toast_snapshot, snapshot->lsn, snapshot->whenTaken);
+   InitToastSnapshot(*toast_snapshot, snapshot->lsn, snapshot->whenTaken);
 }
index 8041e7b67fec091a58140132f0d26ae9298d90f2..fc7328c1e2ea22bcdd41c76d34c71e45a4e8a9a8 100644 (file)
@@ -104,12 +104,9 @@ extern bool ResolveCminCmaxDuringDecoding(struct HTAB *tuplecid_data,
  * Similarly, some initialization is required for SnapshotToast.  We need
  * to set lsn and whenTaken correctly to support snapshot_too_old.
  */
-static inline void
-InitToastSnapshot(Snapshot snapshot, XLogRecPtr lsn, int64 whenTaken)
-{
-   snapshot->satisfies = HeapTupleSatisfiesToast;
-   snapshot->lsn = lsn;
-   snapshot->whenTaken = whenTaken;
-}
+#define InitToastSnapshot(snapshotdata, l, w)  \
+   ((snapshotdata).satisfies = HeapTupleSatisfiesDirty, \
+    (snapshotdata).lsn = (l),                  \
+    (snapshotdata).whenTaken = (w))
 
 #endif   /* TQUAL_H */