pg_query 6.0.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/Rakefile +4 -4
  4. data/ext/pg_query/ext_symbols_freebsd_with_ruby_abi_version.sym +2 -0
  5. data/ext/pg_query/ext_symbols_openbsd.sym +1 -0
  6. data/ext/pg_query/ext_symbols_openbsd_with_ruby_abi_version.sym +2 -0
  7. data/ext/pg_query/ext_symbols_with_ruby_abi_version.sym +2 -0
  8. data/ext/pg_query/extconf.rb +20 -6
  9. data/ext/pg_query/include/pg_query.h +2 -2
  10. data/ext/pg_query/include/postgres/access/amapi.h +4 -0
  11. data/ext/pg_query/include/postgres/access/genam.h +9 -0
  12. data/ext/pg_query/include/postgres/access/slru.h +3 -6
  13. data/ext/pg_query/include/postgres/access/tableam.h +2 -1
  14. data/ext/pg_query/include/postgres/access/transam.h +43 -0
  15. data/ext/pg_query/include/postgres/c.h +1 -1
  16. data/ext/pg_query/include/postgres/catalog/objectaddress.h +4 -0
  17. data/ext/pg_query/include/postgres/commands/event_trigger.h +6 -0
  18. data/ext/pg_query/include/postgres/common/hashfn_unstable.h +6 -52
  19. data/ext/pg_query/include/postgres/datatype/timestamp.h +1 -1
  20. data/ext/pg_query/include/postgres/executor/execdesc.h +1 -1
  21. data/ext/pg_query/include/postgres/libpq/libpq-be.h +6 -3
  22. data/ext/pg_query/include/postgres/mb/pg_wchar.h +1 -0
  23. data/ext/pg_query/include/postgres/miscadmin.h +10 -2
  24. data/ext/pg_query/include/postgres/nodes/execnodes.h +3 -0
  25. data/ext/pg_query/include/postgres/nodes/pathnodes.h +4 -1
  26. data/ext/pg_query/include/postgres/nodes/pg_list.h +1 -1
  27. data/ext/pg_query/include/postgres/nodes/primnodes.h +9 -5
  28. data/ext/pg_query/include/postgres/parser/parse_coerce.h +3 -0
  29. data/ext/pg_query/include/postgres/pg_config.h +28 -20
  30. data/ext/pg_query/include/postgres/port/pg_iovec.h +2 -2
  31. data/ext/pg_query/include/postgres/port/win32_port.h +0 -2
  32. data/ext/pg_query/include/postgres/port.h +32 -1
  33. data/ext/pg_query/include/postgres/replication/reorderbuffer.h +9 -18
  34. data/ext/pg_query/include/postgres/replication/slot.h +5 -1
  35. data/ext/pg_query/include/postgres/storage/lockdefs.h +2 -0
  36. data/ext/pg_query/include/postgres/storage/proc.h +13 -16
  37. data/ext/pg_query/include/postgres/storage/smgr.h +5 -2
  38. data/ext/pg_query/include/postgres/utils/catcache.h +1 -0
  39. data/ext/pg_query/include/postgres/utils/pgstat_internal.h +19 -0
  40. data/ext/pg_query/include/postgres/utils/portal.h +1 -1
  41. data/ext/pg_query/include/postgres/utils/syscache.h +5 -0
  42. data/ext/pg_query/postgres_deparse.c +197 -156
  43. data/ext/pg_query/src_backend_parser_gram.c +1 -1
  44. data/ext/pg_query/src_common_wchar.c +47 -1
  45. data/ext/pg_query/src_port_snprintf.c +14 -17
  46. data/lib/pg_query/fingerprint.rb +3 -5
  47. data/lib/pg_query/param_refs.rb +1 -1
  48. data/lib/pg_query/parse.rb +5 -7
  49. data/lib/pg_query/parse_error.rb +1 -0
  50. data/lib/pg_query/pg_query_pb.rb +1 -22
  51. data/lib/pg_query/scan.rb +1 -0
  52. data/lib/pg_query/treewalker.rb +2 -6
  53. data/lib/pg_query/truncate.rb +17 -19
  54. data/lib/pg_query/version.rb +1 -1
  55. metadata +15 -80
  56. /data/ext/pg_query/{pg_query_ruby.sym → ext_symbols.sym} +0 -0
  57. /data/ext/pg_query/{pg_query_ruby_freebsd.sym → ext_symbols_freebsd.sym} +0 -0
@@ -116,6 +116,10 @@
116
116
  don't. */
117
117
  #define HAVE_DECL_PWRITEV 1
118
118
 
119
+ /* Define to 1 if you have the declaration of `strchrnul', and to 0 if you
120
+ don't. */
121
+ #define HAVE_DECL_STRCHRNUL 0
122
+
119
123
  /* Define to 1 if you have the declaration of `strlcat', and to 0 if you
120
124
  don't. */
121
125
  #define HAVE_DECL_STRLCAT 1
@@ -388,18 +392,12 @@
388
392
  /* Define to 1 if you have the `SSL_CTX_set_num_tickets' function. */
389
393
  /* #undef HAVE_SSL_CTX_SET_NUM_TICKETS */
390
394
 
391
- /* Define to 1 if stdbool.h conforms to C99. */
392
- #define HAVE_STDBOOL_H 1
393
-
394
395
  /* Define to 1 if you have the <stdint.h> header file. */
395
396
  #define HAVE_STDINT_H 1
396
397
 
397
398
  /* Define to 1 if you have the <stdlib.h> header file. */
398
399
  #define HAVE_STDLIB_H 1
399
400
 
400
- /* Define to 1 if you have the `strchrnul' function. */
401
- /* #undef HAVE_STRCHRNUL */
402
-
403
401
  /* Define to 1 if you have the `strerror_r' function. */
404
402
  #define HAVE_STRERROR_R 1
405
403
 
@@ -520,9 +518,6 @@
520
518
  /* Define to 1 if you have XSAVE intrinsics. */
521
519
  /* #undef HAVE_XSAVE_INTRINSICS */
522
520
 
523
- /* Define to 1 if the system has the type `_Bool'. */
524
- #define HAVE__BOOL 1
525
-
526
521
  /* Define to 1 if your compiler understands __builtin_bswap16. */
527
522
  #define HAVE__BUILTIN_BSWAP16 1
528
523
 
@@ -578,7 +573,7 @@
578
573
  #define INT64_MODIFIER "l"
579
574
 
580
575
  /* Define to 1 if `locale_t' requires <xlocale.h>. */
581
- #define LOCALE_T_IN_XLOCALE 1
576
+ /* #undef LOCALE_T_IN_XLOCALE */
582
577
 
583
578
  /* Define as the maximum alignment requirement of any C data type. */
584
579
  #define MAXIMUM_ALIGNOF 8
@@ -597,7 +592,7 @@
597
592
  #define PACKAGE_NAME "PostgreSQL"
598
593
 
599
594
  /* Define to the full name and version of this package. */
600
- #define PACKAGE_STRING "PostgreSQL 17.0"
595
+ #define PACKAGE_STRING "PostgreSQL 17.4"
601
596
 
602
597
  /* Define to the one symbol short name of this package. */
603
598
  #define PACKAGE_TARNAME "postgresql"
@@ -606,7 +601,7 @@
606
601
  #define PACKAGE_URL "https://www.postgresql.org/"
607
602
 
608
603
  /* Define to the version of this package. */
609
- #define PACKAGE_VERSION "17.0"
604
+ #define PACKAGE_VERSION "17.4"
610
605
 
611
606
  /* Define to the name of a signed 128-bit integer type. */
612
607
  #define PG_INT128_TYPE __int128
@@ -625,7 +620,7 @@
625
620
  #define PG_MAJORVERSION_NUM 17
626
621
 
627
622
  /* PostgreSQL minor version number */
628
- #define PG_MINORVERSION_NUM 0
623
+ #define PG_MINORVERSION_NUM 4
629
624
 
630
625
  /* Define to best printf format archetype, usually gnu_printf if available. */
631
626
  #define PG_PRINTF_ATTRIBUTE printf
@@ -634,13 +629,13 @@
634
629
  #define PG_USE_STDBOOL 1
635
630
 
636
631
  /* PostgreSQL version as a string */
637
- #define PG_VERSION "17.0"
632
+ #define PG_VERSION "17.4"
638
633
 
639
634
  /* PostgreSQL version as a number */
640
- #define PG_VERSION_NUM 170000
635
+ #define PG_VERSION_NUM 170004
641
636
 
642
637
  /* A string containing the version number, platform, and C compiler */
643
- #define PG_VERSION_STR "PostgreSQL 17.0 (libpg_query)"
638
+ #define PG_VERSION_STR "PostgreSQL 17.4 (libpg_query)"
644
639
 
645
640
  /* Define to 1 to allow profiling output to be saved separately for each
646
641
  process. */
@@ -825,9 +820,14 @@
825
820
 
826
821
  /* Define to how the compiler spells `typeof'. */
827
822
  /* #undef typeof */
828
- /* This causes compatibility problems on some Linux distros, with "xlocale.h" not being available */
829
- #ifndef __APPLE__
823
+ /*
824
+ * Assume we don't have xlocale.h on non-MacOS, as not all Linux distros have "xlocale.h" available.
825
+ *
826
+ * Note this is required on older MacOS to avoid "unknown type name 'locale_t'"
827
+ */
830
828
  #undef LOCALE_T_IN_XLOCALE
829
+ #ifdef __APPLE__
830
+ #define LOCALE_T_IN_XLOCALE 1
831
831
  #endif
832
832
  #undef WCSTOMBS_L_IN_XLOCALE
833
833
 
@@ -848,10 +848,18 @@
848
848
  #undef USE_ARMV8_CRC32C
849
849
  #undef USE_SSE42_CRC32C_WITH_RUNTIME_CHECK
850
850
 
851
- /* Ensure we do not fail on systems that have strchrnul support (FreeBSD, NetBSD and newer glibc) */
851
+ /*
852
+ * Ensure we use built-in strchrnul on systems that have strchrnul support (FreeBSD, NetBSD and newer glibc)
853
+ *
854
+ * Note MacOS 15.4+ also has strchrnul implemented, but is complex to handle correctly, and the code works
855
+ * around the double define.
856
+ */
852
857
  #include <stdlib.h>
858
+ #undef HAVE_DECL_STRCHRNUL
853
859
  #if defined(__FreeBSD__) || defined(__NetBSD__) || (defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 38) || __GLIBC__ > 2))
854
- #define HAVE_STRCHRNUL
860
+ #define HAVE_DECL_STRCHRNUL 1
861
+ #else
862
+ #define HAVE_DECL_STRCHRNUL 0
855
863
  #endif
856
864
 
857
865
  /* 32-bit */
@@ -68,7 +68,7 @@ pg_preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset)
68
68
  }
69
69
  sum += part;
70
70
  offset += part;
71
- if (part < iov[i].iov_len)
71
+ if ((size_t) part < iov[i].iov_len)
72
72
  return sum;
73
73
  }
74
74
  return sum;
@@ -107,7 +107,7 @@ pg_pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset)
107
107
  }
108
108
  sum += part;
109
109
  offset += part;
110
- if (part < iov[i].iov_len)
110
+ if ((size_t) part < iov[i].iov_len)
111
111
  return sum;
112
112
  }
113
113
  return sum;
@@ -79,8 +79,6 @@
79
79
  /* Must be here to avoid conflicting with prototype in windows.h */
80
80
  #define mkdir(a,b) mkdir(a)
81
81
 
82
- #define ftruncate(a,b) chsize(a,b)
83
-
84
82
  /* Windows doesn't have fsync() as such, use _commit() */
85
83
  #define fsync(fd) _commit(fd)
86
84
 
@@ -53,6 +53,7 @@ extern char *first_path_var_separator(const char *pathlist);
53
53
  extern void join_path_components(char *ret_path,
54
54
  const char *head, const char *tail);
55
55
  extern void canonicalize_path(char *path);
56
+ extern void canonicalize_path_enc(char *path, int encoding);
56
57
  extern void make_native_path(char *filename);
57
58
  extern void cleanup_path(char *path);
58
59
  extern bool path_contains_parent_reference(const char *path);
@@ -306,6 +307,33 @@ extern bool rmtree(const char *path, bool rmtopdir);
306
307
 
307
308
  #if defined(WIN32) && !defined(__CYGWIN__)
308
309
 
310
+ /*
311
+ * We want the 64-bit variant of lseek().
312
+ *
313
+ * For Visual Studio, this must be after <io.h> to avoid messing up its
314
+ * lseek() and _lseeki64() function declarations.
315
+ *
316
+ * For MinGW there is already a macro, so we have to undefine it (depending on
317
+ * _FILE_OFFSET_BITS, it may point at its own lseek64, but we don't want to
318
+ * count on that being set).
319
+ */
320
+ #undef lseek
321
+ #define lseek(a,b,c) _lseeki64((a),(b),(c))
322
+
323
+ /*
324
+ * We want the 64-bit variant of chsize(). It sets errno and also returns it,
325
+ * so convert non-zero result to -1 to match POSIX.
326
+ *
327
+ * Prevent MinGW from declaring functions, and undefine its macro before we
328
+ * define our own.
329
+ */
330
+ #ifndef _MSC_VER
331
+ #define FTRUNCATE_DEFINED
332
+ #include <unistd.h>
333
+ #undef ftruncate
334
+ #endif
335
+ #define ftruncate(a,b) (_chsize_s((a),(b)) == 0 ? 0 : -1)
336
+
309
337
  /*
310
338
  * open() and fopen() replacements to allow deletion of open files and
311
339
  * passing of other special options.
@@ -488,7 +516,10 @@ extern int pg_check_dir(const char *dir);
488
516
  /* port/pgmkdirp.c */
489
517
  extern int pg_mkdir_p(char *path, int omode);
490
518
 
491
- /* port/pqsignal.c */
519
+ /* port/pqsignal.c (see also interfaces/libpq/legacy-pqsignal.c) */
520
+ #ifdef FRONTEND
521
+ #define pqsignal pqsignal_fe
522
+ #endif
492
523
  typedef void (*pqsigfunc) (SIGNAL_ARGS);
493
524
  extern pqsigfunc pqsignal(int signo, pqsigfunc func);
494
525
 
@@ -478,45 +478,38 @@ typedef void (*ReorderBufferRollbackPreparedCB) (ReorderBuffer *rb,
478
478
  TimestampTz prepare_time);
479
479
 
480
480
  /* start streaming transaction callback signature */
481
- typedef void (*ReorderBufferStreamStartCB) (
482
- ReorderBuffer *rb,
481
+ typedef void (*ReorderBufferStreamStartCB) (ReorderBuffer *rb,
483
482
  ReorderBufferTXN *txn,
484
483
  XLogRecPtr first_lsn);
485
484
 
486
485
  /* stop streaming transaction callback signature */
487
- typedef void (*ReorderBufferStreamStopCB) (
488
- ReorderBuffer *rb,
486
+ typedef void (*ReorderBufferStreamStopCB) (ReorderBuffer *rb,
489
487
  ReorderBufferTXN *txn,
490
488
  XLogRecPtr last_lsn);
491
489
 
492
490
  /* discard streamed transaction callback signature */
493
- typedef void (*ReorderBufferStreamAbortCB) (
494
- ReorderBuffer *rb,
491
+ typedef void (*ReorderBufferStreamAbortCB) (ReorderBuffer *rb,
495
492
  ReorderBufferTXN *txn,
496
493
  XLogRecPtr abort_lsn);
497
494
 
498
495
  /* prepare streamed transaction callback signature */
499
- typedef void (*ReorderBufferStreamPrepareCB) (
500
- ReorderBuffer *rb,
496
+ typedef void (*ReorderBufferStreamPrepareCB) (ReorderBuffer *rb,
501
497
  ReorderBufferTXN *txn,
502
498
  XLogRecPtr prepare_lsn);
503
499
 
504
500
  /* commit streamed transaction callback signature */
505
- typedef void (*ReorderBufferStreamCommitCB) (
506
- ReorderBuffer *rb,
501
+ typedef void (*ReorderBufferStreamCommitCB) (ReorderBuffer *rb,
507
502
  ReorderBufferTXN *txn,
508
503
  XLogRecPtr commit_lsn);
509
504
 
510
505
  /* stream change callback signature */
511
- typedef void (*ReorderBufferStreamChangeCB) (
512
- ReorderBuffer *rb,
506
+ typedef void (*ReorderBufferStreamChangeCB) (ReorderBuffer *rb,
513
507
  ReorderBufferTXN *txn,
514
508
  Relation relation,
515
509
  ReorderBufferChange *change);
516
510
 
517
511
  /* stream message callback signature */
518
- typedef void (*ReorderBufferStreamMessageCB) (
519
- ReorderBuffer *rb,
512
+ typedef void (*ReorderBufferStreamMessageCB) (ReorderBuffer *rb,
520
513
  ReorderBufferTXN *txn,
521
514
  XLogRecPtr message_lsn,
522
515
  bool transactional,
@@ -524,16 +517,14 @@ typedef void (*ReorderBufferStreamMessageCB) (
524
517
  const char *message);
525
518
 
526
519
  /* stream truncate callback signature */
527
- typedef void (*ReorderBufferStreamTruncateCB) (
528
- ReorderBuffer *rb,
520
+ typedef void (*ReorderBufferStreamTruncateCB) (ReorderBuffer *rb,
529
521
  ReorderBufferTXN *txn,
530
522
  int nrelations,
531
523
  Relation relations[],
532
524
  ReorderBufferChange *change);
533
525
 
534
526
  /* update progress txn callback signature */
535
- typedef void (*ReorderBufferUpdateProgressTxnCB) (
536
- ReorderBuffer *rb,
527
+ typedef void (*ReorderBufferUpdateProgressTxnCB) (ReorderBuffer *rb,
537
528
  ReorderBufferTXN *txn,
538
529
  XLogRecPtr lsn);
539
530
 
@@ -202,7 +202,11 @@ typedef struct ReplicationSlot
202
202
  */
203
203
  XLogRecPtr last_saved_confirmed_flush;
204
204
 
205
- /* The time since the slot has become inactive */
205
+ /*
206
+ * The time when the slot became inactive. For synced slots on a standby
207
+ * server, it represents the time when slot synchronization was most
208
+ * recently stopped.
209
+ */
206
210
  TimestampTz inactive_since;
207
211
  } ReplicationSlot;
208
212
 
@@ -47,6 +47,8 @@ typedef int LOCKMODE;
47
47
 
48
48
  #define MaxLockMode 8 /* highest standard lock mode */
49
49
 
50
+ /* See README.tuplock section "Locking to write inplace-updated tables" */
51
+ #define InplaceUpdateTupleLock ExclusiveLock
50
52
 
51
53
  /* WAL representation of an AccessExclusiveLock on a table */
52
54
  typedef struct xl_standby_lock
@@ -212,7 +212,7 @@ struct PGPROC
212
212
  Oid tempNamespaceId; /* OID of temp schema this backend is
213
213
  * using */
214
214
 
215
- bool isBackgroundWorker; /* true if background worker. */
215
+ bool isBackgroundWorker; /* true if not a regular backend. */
216
216
 
217
217
  /*
218
218
  * While in hot standby mode, shows that a conflict signal has been sent
@@ -313,19 +313,6 @@ struct PGPROC
313
313
 
314
314
  extern PGDLLIMPORT PGPROC *MyProc;
315
315
 
316
- /* Proc number of this backend. Equal to GetNumberFromPGProc(MyProc). */
317
- extern PGDLLIMPORT ProcNumber MyProcNumber;
318
-
319
- /* Our parallel session leader, or INVALID_PROC_NUMBER if none */
320
- extern PGDLLIMPORT ProcNumber ParallelLeaderProcNumber;
321
-
322
- /*
323
- * The proc number to use for our session's temp relations is normally our own,
324
- * but parallel workers should use their leader's ID.
325
- */
326
- #define ProcNumberForTempRelations() \
327
- (ParallelLeaderProcNumber == INVALID_PROC_NUMBER ? MyProcNumber : ParallelLeaderProcNumber)
328
-
329
316
  /*
330
317
  * There is one ProcGlobal struct for the whole database cluster.
331
318
  *
@@ -404,7 +391,7 @@ typedef struct PROC_HDR
404
391
  uint32 allProcCount;
405
392
  /* Head of list of free PGPROC structures */
406
393
  dlist_head freeProcs;
407
- /* Head of list of autovacuum's free PGPROC structures */
394
+ /* Head of list of autovacuum & special worker free PGPROC structures */
408
395
  dlist_head autovacFreeProcs;
409
396
  /* Head of list of bgworker free PGPROC structures */
410
397
  dlist_head bgworkerFreeProcs;
@@ -434,9 +421,19 @@ extern PGDLLIMPORT PGPROC *PreparedXactProcs;
434
421
  #define GetPGProcByNumber(n) (&ProcGlobal->allProcs[(n)])
435
422
  #define GetNumberFromPGProc(proc) ((proc) - &ProcGlobal->allProcs[0])
436
423
 
424
+ /*
425
+ * We set aside some extra PGPROC structures for "special worker" processes,
426
+ * which are full-fledged backends (they can run transactions)
427
+ * but are unique animals that there's never more than one of.
428
+ * Currently there are two such processes: the autovacuum launcher
429
+ * and the slotsync worker.
430
+ */
431
+ #define NUM_SPECIAL_WORKER_PROCS 2
432
+
437
433
  /*
438
434
  * We set aside some extra PGPROC structures for auxiliary processes,
439
- * ie things that aren't full-fledged backends but need shmem access.
435
+ * ie things that aren't full-fledged backends (they cannot run transactions
436
+ * or take heavyweight locks) but need shmem access.
440
437
  *
441
438
  * Background writer, checkpointer, WAL writer, WAL summarizer, and archiver
442
439
  * run during normal operation. Startup process and WAL receiver also consume
@@ -103,8 +103,11 @@ extern void smgrwriteback(SMgrRelation reln, ForkNumber forknum,
103
103
  BlockNumber blocknum, BlockNumber nblocks);
104
104
  extern BlockNumber smgrnblocks(SMgrRelation reln, ForkNumber forknum);
105
105
  extern BlockNumber smgrnblocks_cached(SMgrRelation reln, ForkNumber forknum);
106
- extern void smgrtruncate(SMgrRelation reln, ForkNumber *forknum,
107
- int nforks, BlockNumber *nblocks);
106
+ extern void smgrtruncate(SMgrRelation reln, ForkNumber *forknum, int nforks,
107
+ BlockNumber *nblocks);
108
+ extern void smgrtruncate2(SMgrRelation reln, ForkNumber *forknum, int nforks,
109
+ BlockNumber *old_nblocks,
110
+ BlockNumber *nblocks);
108
111
  extern void smgrimmedsync(SMgrRelation reln, ForkNumber forknum);
109
112
  extern void smgrregistersync(SMgrRelation reln, ForkNumber forknum);
110
113
  extern void AtEOXact_SMgr(void);
@@ -220,6 +220,7 @@ extern CatCList *SearchCatCacheList(CatCache *cache, int nkeys,
220
220
  extern void ReleaseCatCacheList(CatCList *list);
221
221
 
222
222
  extern void ResetCatalogCaches(void);
223
+ extern void ResetCatalogCachesExt(bool debug_discard);
223
224
  extern void CatalogCacheFlushCatalog(Oid catId);
224
225
  extern void CatCacheInvalidate(CatCache *cache, uint32 hashValue);
225
226
  extern void PrepareToInvalidateCacheTuple(Relation relation,
@@ -93,6 +93,19 @@ typedef struct PgStatShared_HashEntry
93
93
  */
94
94
  pg_atomic_uint32 refcount;
95
95
 
96
+ /*
97
+ * Counter tracking the number of times the entry has been reused.
98
+ *
99
+ * Set to 0 when the entry is created, and incremented by one each time
100
+ * the shared entry is reinitialized with pgstat_reinit_entry().
101
+ *
102
+ * May only be incremented / decremented while holding at least a shared
103
+ * lock on the dshash partition containing the entry. Like refcount, it
104
+ * needs to be an atomic variable because multiple backends can increment
105
+ * the generation with just a shared lock.
106
+ */
107
+ pg_atomic_uint32 generation;
108
+
96
109
  /*
97
110
  * Pointer to shared stats. The stats entry always starts with
98
111
  * PgStatShared_Common, embedded in a larger struct containing the
@@ -132,6 +145,12 @@ typedef struct PgStat_EntryRef
132
145
  */
133
146
  PgStatShared_Common *shared_stats;
134
147
 
148
+ /*
149
+ * Copy of PgStatShared_HashEntry->generation, keeping locally track of
150
+ * the shared stats entry "generation" retrieved (number of times reused).
151
+ */
152
+ uint32 generation;
153
+
135
154
  /*
136
155
  * Pending statistics data that will need to be flushed to shared memory
137
156
  * stats eventually. Each stats kind utilizing pending data defines what
@@ -145,7 +145,7 @@ typedef struct PortalData
145
145
  /* Features/options */
146
146
  PortalStrategy strategy; /* see above */
147
147
  int cursorOptions; /* DECLARE CURSOR option bits */
148
- bool run_once; /* portal will only be run once */
148
+ bool run_once; /* unused */
149
149
 
150
150
  /* Status data */
151
151
  PortalStatus status; /* see above */
@@ -43,9 +43,14 @@ extern HeapTuple SearchSysCache4(int cacheId,
43
43
 
44
44
  extern void ReleaseSysCache(HeapTuple tuple);
45
45
 
46
+ extern HeapTuple SearchSysCacheLocked1(int cacheId,
47
+ Datum key1);
48
+
46
49
  /* convenience routines */
47
50
  extern HeapTuple SearchSysCacheCopy(int cacheId,
48
51
  Datum key1, Datum key2, Datum key3, Datum key4);
52
+ extern HeapTuple SearchSysCacheLockedCopy1(int cacheId,
53
+ Datum key1);
49
54
  extern bool SearchSysCacheExists(int cacheId,
50
55
  Datum key1, Datum key2, Datum key3, Datum key4);
51
56
  extern Oid GetSysCacheOid(int cacheId, AttrNumber oidcol,