diff options
Diffstat (limited to 'src/include')
38 files changed, 261 insertions, 228 deletions
diff --git a/src/include/access/gin_private.h b/src/include/access/gin_private.h index 9ea303a7c1b..db19ffd9897 100644 --- a/src/include/access/gin_private.h +++ b/src/include/access/gin_private.h @@ -333,7 +333,7 @@ typedef struct GinScanKeyData bool curItemMatches; bool recheckCurItem; bool isFinished; -} GinScanKeyData; +} GinScanKeyData; typedef struct GinScanEntryData { @@ -478,7 +478,7 @@ extern void ginInsertCleanup(GinState *ginstate, bool full_clean, /* ginpostinglist.c */ -extern GinPostingList *ginCompressPostingList(const ItemPointer ipd, int nipd, +extern GinPostingList *ginCompressPostingList(const ItemPointerData *ipd, int nipd, int maxsize, int *nwritten); extern int ginPostingListDecodeAllSegmentsToTbm(GinPostingList *ptr, int len, TIDBitmap *tbm); diff --git a/src/include/access/hash.h b/src/include/access/hash.h index 073ad29b19b..839c343122c 100644 --- a/src/include/access/hash.h +++ b/src/include/access/hash.h @@ -453,7 +453,7 @@ typedef struct HSpool HSpool; /* opaque struct in hashsort.c */ extern HSpool *_h_spoolinit(Relation heap, Relation index, uint32 num_buckets); extern void _h_spooldestroy(HSpool *hspool); -extern void _h_spool(HSpool *hspool, ItemPointer self, +extern void _h_spool(HSpool *hspool, const ItemPointerData *self, const Datum *values, const bool *isnull); extern void _h_indexbuild(HSpool *hspool, Relation heapRel); @@ -468,7 +468,7 @@ extern uint32 _hash_get_totalbuckets(uint32 splitpoint_phase); extern void _hash_checkpage(Relation rel, Buffer buf, int flags); extern uint32 _hash_get_indextuple_hashkey(IndexTuple itup); extern bool _hash_convert_tuple(Relation index, - Datum *user_values, bool *user_isnull, + const Datum *user_values, const bool *user_isnull, Datum *index_values, bool *index_isnull); extern OffsetNumber _hash_binsearch(Page page, uint32 hash_value); extern OffsetNumber _hash_binsearch_last(Page page, uint32 hash_value); diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h index 8cbff6ab0eb..909db73b7bb 100644 --- a/src/include/access/heapam.h +++ b/src/include/access/heapam.h @@ -316,12 +316,12 @@ extern void heap_insert(Relation relation, HeapTuple tup, CommandId cid, extern void heap_multi_insert(Relation relation, TupleTableSlot **slots, int ntuples, CommandId cid, int options, BulkInsertState bistate); -extern TM_Result heap_delete(Relation relation, ItemPointer tid, +extern TM_Result heap_delete(Relation relation, const ItemPointerData *tid, CommandId cid, Snapshot crosscheck, bool wait, TM_FailureData *tmfd, bool changingPart); -extern void heap_finish_speculative(Relation relation, ItemPointer tid); -extern void heap_abort_speculative(Relation relation, ItemPointer tid); -extern TM_Result heap_update(Relation relation, ItemPointer otid, +extern void heap_finish_speculative(Relation relation, const ItemPointerData *tid); +extern void heap_abort_speculative(Relation relation, const ItemPointerData *tid); +extern TM_Result heap_update(Relation relation, const ItemPointerData *otid, HeapTuple newtup, CommandId cid, Snapshot crosscheck, bool wait, TM_FailureData *tmfd, LockTupleMode *lockmode, @@ -358,8 +358,8 @@ extern bool heap_tuple_should_freeze(HeapTupleHeader tuple, extern bool heap_tuple_needs_eventual_freeze(HeapTupleHeader tuple); extern void simple_heap_insert(Relation relation, HeapTuple tup); -extern void simple_heap_delete(Relation relation, ItemPointer tid); -extern void simple_heap_update(Relation relation, ItemPointer otid, +extern void simple_heap_delete(Relation relation, const ItemPointerData *tid); +extern void simple_heap_update(Relation relation, const ItemPointerData *otid, HeapTuple tup, TU_UpdateIndexes *update_indexes); extern TransactionId heap_index_delete_tuples(Relation rel, diff --git a/src/include/access/heaptoast.h b/src/include/access/heaptoast.h index 6385a27caf8..1c68f8107d6 100644 --- a/src/include/access/heaptoast.h +++ b/src/include/access/heaptoast.h @@ -133,8 +133,8 @@ extern Datum toast_flatten_tuple_to_datum(HeapTupleHeader tup, * ---------- */ extern HeapTuple toast_build_flattened_tuple(TupleDesc tupleDesc, - Datum *values, - bool *isnull); + const Datum *values, + const bool *isnull); /* ---------- * heap_fetch_toast_slice diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h index db1345f54c8..16be5c7a9c1 100644 --- a/src/include/access/nbtree.h +++ b/src/include/access/nbtree.h @@ -1234,7 +1234,7 @@ extern void _bt_dedup_start_pending(BTDedupState state, IndexTuple base, OffsetNumber baseoff); extern bool _bt_dedup_save_htid(BTDedupState state, IndexTuple itup); extern Size _bt_dedup_finish_pending(Page newpage, BTDedupState state); -extern IndexTuple _bt_form_posting(IndexTuple base, ItemPointer htids, +extern IndexTuple _bt_form_posting(IndexTuple base, const ItemPointerData *htids, int nhtids); extern void _bt_update_posting(BTVacuumPosting vacposting); extern IndexTuple _bt_swap_posting(IndexTuple newitem, IndexTuple oposting, diff --git a/src/include/access/spgist_private.h b/src/include/access/spgist_private.h index 781e1e12e55..083af5962a8 100644 --- a/src/include/access/spgist_private.h +++ b/src/include/access/spgist_private.h @@ -511,7 +511,7 @@ extern unsigned int SpGistGetInnerTypeSize(SpGistTypeDesc *att, Datum datum); extern Size SpGistGetLeafTupleSize(TupleDesc tupleDescriptor, const Datum *datums, const bool *isnulls); extern SpGistLeafTuple spgFormLeafTuple(SpGistState *state, - ItemPointer heapPtr, + const ItemPointerData *heapPtr, const Datum *datums, const bool *isnulls); extern SpGistNodeTuple spgFormNodeTuple(SpGistState *state, Datum label, bool isnull); @@ -541,7 +541,7 @@ extern void spgPageIndexMultiDelete(SpGistState *state, Page page, int firststate, int reststate, BlockNumber blkno, OffsetNumber offnum); extern bool spgdoinsert(Relation index, SpGistState *state, - ItemPointer heapPtr, Datum *datums, bool *isnulls); + const ItemPointerData *heapPtr, const Datum *datums, const bool *isnulls); /* spgproc.c */ extern double *spg_key_orderbys_distances(Datum key, bool isLeaf, diff --git a/src/include/access/tidstore.h b/src/include/access/tidstore.h index 041091df278..048e1df0e84 100644 --- a/src/include/access/tidstore.h +++ b/src/include/access/tidstore.h @@ -40,7 +40,7 @@ extern void TidStoreUnlock(TidStore *ts); extern void TidStoreDestroy(TidStore *ts); extern void TidStoreSetBlockOffsets(TidStore *ts, BlockNumber blkno, OffsetNumber *offsets, int num_offsets); -extern bool TidStoreIsMember(TidStore *ts, ItemPointer tid); +extern bool TidStoreIsMember(TidStore *ts, const ItemPointerData *tid); extern TidStoreIter *TidStoreBeginIterate(TidStore *ts); extern TidStoreIterResult *TidStoreIterateNext(TidStoreIter *iter); extern int TidStoreGetBlockOffsets(TidStoreIterResult *result, diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h index d12798be3d8..a12757e46e5 100644 --- a/src/include/access/xlog.h +++ b/src/include/access/xlog.h @@ -202,6 +202,7 @@ extern XLogRecPtr XLogInsertRecord(struct XLogRecData *rdata, XLogRecPtr fpw_lsn, uint8 flags, int num_fpi, + uint64 fpi_bytes, bool topxid_included); extern void XLogFlush(XLogRecPtr record); extern bool XLogBackgroundFlush(void); diff --git a/src/include/c.h b/src/include/c.h index 9ab5e617995..757dfff4782 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -93,8 +93,6 @@ /* ---------------------------------------------------------------- * Section 1: compiler characteristics - * - * type prefixes (const, signed, volatile, inline) are handled in pg_config.h. * ---------------------------------------------------------------- */ @@ -109,6 +107,12 @@ #endif /* + * Previously used PostgreSQL-specific spelling, for backward compatibility + * for extensions. + */ +#define pg_restrict restrict + +/* * Attribute macros * * GCC: https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html @@ -1372,6 +1376,29 @@ typedef intptr_t sigjmp_buf[5]; /* /port compatibility functions */ #include "port.h" +/* + * char16_t and char32_t + * Unicode code points. + * + * uchar.h should always be available in C11, but it's not available on + * Mac. However, these types are keywords in C++11, so when using C++, we + * can't redefine the types. + * + * XXX: when uchar.h is available everywhere, we can remove this check and + * just include uchar.h unconditionally. + * + * XXX: this section is out of place because uchar.h needs to be included + * after port.h, due to an interaction with win32_port.h in some cases. + */ +#ifdef HAVE_UCHAR_H +#include <uchar.h> +#else +#ifndef __cplusplus +typedef uint16_t char16_t; +typedef uint32_t char32_t; +#endif +#endif + /* IWYU pragma: end_exports */ #endif /* C_H */ diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 1b0b16a343f..18e95179ab6 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -57,6 +57,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 202510221 +#define CATALOG_VERSION_NO 202510281 #endif diff --git a/src/include/catalog/index.h b/src/include/catalog/index.h index 4daa8bef5ee..dda95e54903 100644 --- a/src/include/catalog/index.h +++ b/src/include/catalog/index.h @@ -187,7 +187,7 @@ extern void IndexSetParentIndex(Relation partitionIdx, Oid parentOid); * As noted in validate_index(), this can be significantly faster. */ static inline int64 -itemptr_encode(ItemPointer itemptr) +itemptr_encode(const ItemPointerData *itemptr) { BlockNumber block = ItemPointerGetBlockNumber(itemptr); OffsetNumber offset = ItemPointerGetOffsetNumber(itemptr); diff --git a/src/include/catalog/indexing.h b/src/include/catalog/indexing.h index 667aca7ace8..77c17d3fb7a 100644 --- a/src/include/catalog/indexing.h +++ b/src/include/catalog/indexing.h @@ -44,11 +44,11 @@ extern void CatalogTuplesMultiInsertWithInfo(Relation heapRel, TupleTableSlot **slot, int ntuples, CatalogIndexState indstate); -extern void CatalogTupleUpdate(Relation heapRel, ItemPointer otid, +extern void CatalogTupleUpdate(Relation heapRel, const ItemPointerData *otid, HeapTuple tup); extern void CatalogTupleUpdateWithInfo(Relation heapRel, - ItemPointer otid, HeapTuple tup, + const ItemPointerData *otid, HeapTuple tup, CatalogIndexState indstate); -extern void CatalogTupleDelete(Relation heapRel, ItemPointer tid); +extern void CatalogTupleDelete(Relation heapRel, const ItemPointerData *tid); #endif /* INDEXING_H */ diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat index eecb43ec6f0..9121a382f76 100644 --- a/src/include/catalog/pg_proc.dat +++ b/src/include/catalog/pg_proc.dat @@ -6029,16 +6029,16 @@ { oid => '1136', descr => 'statistics: information about WAL activity', proname => 'pg_stat_get_wal', proisstrict => 'f', provolatile => 's', proparallel => 'r', prorettype => 'record', proargtypes => '', - proallargtypes => '{int8,int8,numeric,int8,timestamptz}', - proargmodes => '{o,o,o,o,o}', - proargnames => '{wal_records,wal_fpi,wal_bytes,wal_buffers_full,stats_reset}', + proallargtypes => '{int8,int8,numeric,numeric,int8,timestamptz}', + proargmodes => '{o,o,o,o,o,o}', + proargnames => '{wal_records,wal_fpi,wal_bytes,wal_fpi_bytes,wal_buffers_full,stats_reset}', prosrc => 'pg_stat_get_wal' }, { oid => '6313', descr => 'statistics: backend WAL activity', proname => 'pg_stat_get_backend_wal', provolatile => 'v', proparallel => 'r', prorettype => 'record', proargtypes => 'int4', - proallargtypes => '{int4,int8,int8,numeric,int8,timestamptz}', - proargmodes => '{i,o,o,o,o,o}', - proargnames => '{backend_pid,wal_records,wal_fpi,wal_bytes,wal_buffers_full,stats_reset}', + proallargtypes => '{int4,int8,int8,numeric,numeric,int8,timestamptz}', + proargmodes => '{i,o,o,o,o,o,o}', + proargnames => '{backend_pid,wal_records,wal_fpi,wal_bytes,wal_fpi_bytes,wal_buffers_full,stats_reset}', prosrc => 'pg_stat_get_backend_wal' }, { oid => '6248', descr => 'statistics: information about WAL prefetching', proname => 'pg_stat_get_recovery_prefetch', prorows => '1', proretset => 't', diff --git a/src/include/common/logging.h b/src/include/common/logging.h index 81529ee8f29..2e0333dc009 100644 --- a/src/include/common/logging.h +++ b/src/include/common/logging.h @@ -93,10 +93,10 @@ void pg_logging_set_pre_callback(void (*cb) (void)); void pg_logging_set_locus_callback(void (*cb) (const char **filename, uint64 *lineno)); void pg_log_generic(enum pg_log_level level, enum pg_log_part part, - const char *pg_restrict fmt,...) + const char *restrict fmt,...) pg_attribute_printf(3, 4); void pg_log_generic_v(enum pg_log_level level, enum pg_log_part part, - const char *pg_restrict fmt, va_list ap) + const char *restrict fmt, va_list ap) pg_attribute_printf(3, 0); /* diff --git a/src/include/common/string.h b/src/include/common/string.h index 55ed8774364..32a97c24b22 100644 --- a/src/include/common/string.h +++ b/src/include/common/string.h @@ -25,7 +25,7 @@ typedef struct PromptInterruptContext /* functions in src/common/string.c */ extern bool pg_str_endswith(const char *str, const char *end); -extern int strtoint(const char *pg_restrict str, char **pg_restrict endptr, +extern int strtoint(const char *restrict str, char **restrict endptr, int base); extern char *pg_clean_ascii(const char *str, int alloc_flags); extern int pg_strip_crlf(char *str); diff --git a/src/include/common/unicode_case.h b/src/include/common/unicode_case.h index 41e2c1f4b33..6bcffd349c2 100644 --- a/src/include/common/unicode_case.h +++ b/src/include/common/unicode_case.h @@ -14,14 +14,12 @@ #ifndef UNICODE_CASE_H #define UNICODE_CASE_H -#include "mb/pg_wchar.h" - typedef size_t (*WordBoundaryNext) (void *wbstate); -pg_wchar unicode_lowercase_simple(pg_wchar code); -pg_wchar unicode_titlecase_simple(pg_wchar code); -pg_wchar unicode_uppercase_simple(pg_wchar code); -pg_wchar unicode_casefold_simple(pg_wchar code); +char32_t unicode_lowercase_simple(char32_t code); +char32_t unicode_titlecase_simple(char32_t code); +char32_t unicode_uppercase_simple(char32_t code); +char32_t unicode_casefold_simple(char32_t code); size_t unicode_strlower(char *dst, size_t dstsize, const char *src, ssize_t srclen, bool full); size_t unicode_strtitle(char *dst, size_t dstsize, const char *src, diff --git a/src/include/common/unicode_case_table.h b/src/include/common/unicode_case_table.h index d5311786582..0a14fb2d97b 100644 --- a/src/include/common/unicode_case_table.h +++ b/src/include/common/unicode_case_table.h @@ -18,7 +18,6 @@ */ #include "common/unicode_case.h" -#include "mb/pg_wchar.h" /* * The maximum number of codepoints that can result from case mapping @@ -45,7 +44,7 @@ typedef enum typedef struct { int16 conditions; - pg_wchar map[NCaseKind][MAX_CASE_EXPANSION]; + char32_t map[NCaseKind][MAX_CASE_EXPANSION]; } pg_special_case; /* @@ -166,7 +165,7 @@ static const pg_special_case special_case[106] = * The entry case_map_lower[case_index(codepoint)] is the mapping for the * given codepoint. */ -static const pg_wchar case_map_lower[1704] = +static const char32_t case_map_lower[1704] = { 0x000000, /* reserved */ 0x000000, /* U+000000 */ @@ -1879,7 +1878,7 @@ static const pg_wchar case_map_lower[1704] = * The entry case_map_title[case_index(codepoint)] is the mapping for the * given codepoint. */ -static const pg_wchar case_map_title[1704] = +static const char32_t case_map_title[1704] = { 0x000000, /* reserved */ 0x000000, /* U+000000 */ @@ -3592,7 +3591,7 @@ static const pg_wchar case_map_title[1704] = * The entry case_map_upper[case_index(codepoint)] is the mapping for the * given codepoint. */ -static const pg_wchar case_map_upper[1704] = +static const char32_t case_map_upper[1704] = { 0x000000, /* reserved */ 0x000000, /* U+000000 */ @@ -5305,7 +5304,7 @@ static const pg_wchar case_map_upper[1704] = * The entry case_map_fold[case_index(codepoint)] is the mapping for the * given codepoint. */ -static const pg_wchar case_map_fold[1704] = +static const char32_t case_map_fold[1704] = { 0x000000, /* reserved */ 0x000000, /* U+000000 */ @@ -13522,7 +13521,7 @@ static const uint16 case_map[4778] = * the offset into the mapping tables. */ static inline uint16 -case_index(pg_wchar cp) +case_index(char32_t cp) { /* Fast path for codepoints < 0x0588 */ if (cp < 0x0588) diff --git a/src/include/common/unicode_category.h b/src/include/common/unicode_category.h index 8fd8b67a416..684143d3c8a 100644 --- a/src/include/common/unicode_category.h +++ b/src/include/common/unicode_category.h @@ -14,8 +14,6 @@ #ifndef UNICODE_CATEGORY_H #define UNICODE_CATEGORY_H -#include "mb/pg_wchar.h" - /* * Unicode General Category Values * @@ -61,31 +59,31 @@ typedef enum pg_unicode_category PG_U_FINAL_PUNCTUATION = 29 /* Pf */ } pg_unicode_category; -extern pg_unicode_category unicode_category(pg_wchar code); +extern pg_unicode_category unicode_category(char32_t code); extern const char *unicode_category_string(pg_unicode_category category); extern const char *unicode_category_abbrev(pg_unicode_category category); -extern bool pg_u_prop_alphabetic(pg_wchar code); -extern bool pg_u_prop_lowercase(pg_wchar code); -extern bool pg_u_prop_uppercase(pg_wchar code); -extern bool pg_u_prop_cased(pg_wchar code); -extern bool pg_u_prop_case_ignorable(pg_wchar code); -extern bool pg_u_prop_white_space(pg_wchar code); -extern bool pg_u_prop_hex_digit(pg_wchar code); -extern bool pg_u_prop_join_control(pg_wchar code); +extern bool pg_u_prop_alphabetic(char32_t code); +extern bool pg_u_prop_lowercase(char32_t code); +extern bool pg_u_prop_uppercase(char32_t code); +extern bool pg_u_prop_cased(char32_t code); +extern bool pg_u_prop_case_ignorable(char32_t code); +extern bool pg_u_prop_white_space(char32_t code); +extern bool pg_u_prop_hex_digit(char32_t code); +extern bool pg_u_prop_join_control(char32_t code); -extern bool pg_u_isdigit(pg_wchar code, bool posix); -extern bool pg_u_isalpha(pg_wchar code); -extern bool pg_u_isalnum(pg_wchar code, bool posix); -extern bool pg_u_isword(pg_wchar code); -extern bool pg_u_isupper(pg_wchar code); -extern bool pg_u_islower(pg_wchar code); -extern bool pg_u_isblank(pg_wchar code); -extern bool pg_u_iscntrl(pg_wchar code); -extern bool pg_u_isgraph(pg_wchar code); -extern bool pg_u_isprint(pg_wchar code); -extern bool pg_u_ispunct(pg_wchar code, bool posix); -extern bool pg_u_isspace(pg_wchar code); -extern bool pg_u_isxdigit(pg_wchar code, bool posix); +extern bool pg_u_isdigit(char32_t code, bool posix); +extern bool pg_u_isalpha(char32_t code); +extern bool pg_u_isalnum(char32_t code, bool posix); +extern bool pg_u_isword(char32_t code); +extern bool pg_u_isupper(char32_t code); +extern bool pg_u_islower(char32_t code); +extern bool pg_u_isblank(char32_t code); +extern bool pg_u_iscntrl(char32_t code); +extern bool pg_u_isgraph(char32_t code); +extern bool pg_u_isprint(char32_t code); +extern bool pg_u_ispunct(char32_t code, bool posix); +extern bool pg_u_isspace(char32_t code); +extern bool pg_u_isxdigit(char32_t code, bool posix); #endif /* UNICODE_CATEGORY_H */ diff --git a/src/include/common/unicode_category_table.h b/src/include/common/unicode_category_table.h index 95a1c65da7e..466a41b72b0 100644 --- a/src/include/common/unicode_category_table.h +++ b/src/include/common/unicode_category_table.h @@ -20,15 +20,15 @@ */ typedef struct { - uint32 first; /* Unicode codepoint */ - uint32 last; /* Unicode codepoint */ + char32_t first; /* Unicode codepoint */ + char32_t last; /* Unicode codepoint */ uint8 category; /* General Category */ } pg_category_range; typedef struct { - uint32 first; /* Unicode codepoint */ - uint32 last; /* Unicode codepoint */ + char32_t first; /* Unicode codepoint */ + char32_t last; /* Unicode codepoint */ } pg_unicode_range; typedef struct diff --git a/src/include/common/unicode_norm.h b/src/include/common/unicode_norm.h index 5bc3b79e78e..516c192cc4c 100644 --- a/src/include/common/unicode_norm.h +++ b/src/include/common/unicode_norm.h @@ -14,8 +14,6 @@ #ifndef UNICODE_NORM_H #define UNICODE_NORM_H -#include "mb/pg_wchar.h" - typedef enum { UNICODE_NFC = 0, @@ -32,8 +30,8 @@ typedef enum UNICODE_NORM_QC_MAYBE = -1, } UnicodeNormalizationQC; -extern pg_wchar *unicode_normalize(UnicodeNormalizationForm form, const pg_wchar *input); +extern char32_t *unicode_normalize(UnicodeNormalizationForm form, const char32_t *input); -extern UnicodeNormalizationQC unicode_is_normalized_quickcheck(UnicodeNormalizationForm form, const pg_wchar *input); +extern UnicodeNormalizationQC unicode_is_normalized_quickcheck(UnicodeNormalizationForm form, const char32_t *input); #endif /* UNICODE_NORM_H */ diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h index 0ba86c2ad72..8e7a5453064 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -141,7 +141,7 @@ extern TupleHashTable BuildTupleHashTable(PlanState *parent, long nbuckets, Size additionalsize, MemoryContext metacxt, - MemoryContext tablecxt, + MemoryContext tuplescxt, MemoryContext tempcxt, bool use_variable_hash_iv); extern TupleHashEntry LookupTupleHashEntry(TupleHashTable hashtable, @@ -745,11 +745,11 @@ extern List *ExecInsertIndexTuples(ResultRelInfo *resultRelInfo, extern bool ExecCheckIndexConstraints(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate, ItemPointer conflictTid, - ItemPointer tupleid, + const ItemPointerData *tupleid, List *arbiterIndexes); extern void check_exclusion_constraint(Relation heap, Relation index, IndexInfo *indexInfo, - ItemPointer tupleid, + const ItemPointerData *tupleid, const Datum *values, const bool *isnull, EState *estate, bool newIndex); diff --git a/src/include/executor/instrument.h b/src/include/executor/instrument.h index 03653ab6c6c..ffe470f2b84 100644 --- a/src/include/executor/instrument.h +++ b/src/include/executor/instrument.h @@ -53,6 +53,7 @@ typedef struct WalUsage int64 wal_records; /* # of WAL records produced */ int64 wal_fpi; /* # of WAL full page images produced */ uint64 wal_bytes; /* size of WAL records produced */ + uint64 wal_fpi_bytes; /* size of WAL full page images produced */ int64 wal_buffers_full; /* # of times the WAL buffers became full */ } WalUsage; diff --git a/src/include/executor/spi.h b/src/include/executor/spi.h index d064d1a9b76..de516e5700a 100644 --- a/src/include/executor/spi.h +++ b/src/include/executor/spi.h @@ -111,7 +111,7 @@ extern int SPI_finish(void); extern int SPI_execute(const char *src, bool read_only, long tcount); extern int SPI_execute_extended(const char *src, const SPIExecuteOptions *options); -extern int SPI_execute_plan(SPIPlanPtr plan, Datum *Values, const char *Nulls, +extern int SPI_execute_plan(SPIPlanPtr plan, const Datum *Values, const char *Nulls, bool read_only, long tcount); extern int SPI_execute_plan_extended(SPIPlanPtr plan, const SPIExecuteOptions *options); @@ -122,13 +122,13 @@ extern int SPI_exec(const char *src, long tcount); extern int SPI_execp(SPIPlanPtr plan, Datum *Values, const char *Nulls, long tcount); extern int SPI_execute_snapshot(SPIPlanPtr plan, - Datum *Values, const char *Nulls, + const Datum *Values, const char *Nulls, Snapshot snapshot, Snapshot crosscheck_snapshot, bool read_only, bool fire_triggers, long tcount); extern int SPI_execute_with_args(const char *src, int nargs, Oid *argtypes, - Datum *Values, const char *Nulls, + const Datum *Values, const char *Nulls, bool read_only, long tcount); extern SPIPlanPtr SPI_prepare(const char *src, int nargs, Oid *argtypes); extern SPIPlanPtr SPI_prepare_cursor(const char *src, int nargs, Oid *argtypes, @@ -172,7 +172,7 @@ extern void SPI_freetuple(HeapTuple tuple); extern void SPI_freetuptable(SPITupleTable *tuptable); extern Portal SPI_cursor_open(const char *name, SPIPlanPtr plan, - Datum *Values, const char *Nulls, bool read_only); + const Datum *Values, const char *Nulls, bool read_only); extern Portal SPI_cursor_open_with_args(const char *name, const char *src, int nargs, Oid *argtypes, diff --git a/src/include/libpq/pqformat.h b/src/include/libpq/pqformat.h index 55442caf0e4..127a74e299a 100644 --- a/src/include/libpq/pqformat.h +++ b/src/include/libpq/pqformat.h @@ -34,7 +34,7 @@ extern void pq_sendfloat8(StringInfo buf, float8 f); * Append a [u]int8 to a StringInfo buffer, which already has enough space * preallocated. * - * The use of pg_restrict allows the compiler to optimize the code based on + * The use of restrict allows the compiler to optimize the code based on * the assumption that buf, buf->len, buf->data and *buf->data don't * overlap. Without the annotation buf->len etc cannot be kept in a register * over subsequent pq_writeintN calls. @@ -43,7 +43,7 @@ extern void pq_sendfloat8(StringInfo buf, float8 f); * overly picky and demanding a * before a restrict. */ static inline void -pq_writeint8(StringInfoData *pg_restrict buf, uint8 i) +pq_writeint8(StringInfoData *restrict buf, uint8 i) { uint8 ni = i; @@ -57,7 +57,7 @@ pq_writeint8(StringInfoData *pg_restrict buf, uint8 i) * preallocated. */ static inline void -pq_writeint16(StringInfoData *pg_restrict buf, uint16 i) +pq_writeint16(StringInfoData *restrict buf, uint16 i) { uint16 ni = pg_hton16(i); @@ -71,7 +71,7 @@ pq_writeint16(StringInfoData *pg_restrict buf, uint16 i) * preallocated. */ static inline void -pq_writeint32(StringInfoData *pg_restrict buf, uint32 i) +pq_writeint32(StringInfoData *restrict buf, uint32 i) { uint32 ni = pg_hton32(i); @@ -85,7 +85,7 @@ pq_writeint32(StringInfoData *pg_restrict buf, uint32 i) * preallocated. */ static inline void -pq_writeint64(StringInfoData *pg_restrict buf, uint64 i) +pq_writeint64(StringInfoData *restrict buf, uint64 i) { uint64 ni = pg_hton64(i); @@ -105,7 +105,7 @@ pq_writeint64(StringInfoData *pg_restrict buf, uint64 i) * sent to the frontend. */ static inline void -pq_writestring(StringInfoData *pg_restrict buf, const char *pg_restrict str) +pq_writestring(StringInfoData *restrict buf, const char *restrict str) { int slen = strlen(str); char *p; diff --git a/src/include/mb/pg_wchar.h b/src/include/mb/pg_wchar.h index 4b4a9974b75..4d84bdc81e4 100644 --- a/src/include/mb/pg_wchar.h +++ b/src/include/mb/pg_wchar.h @@ -532,25 +532,25 @@ typedef uint32 (*utf_local_conversion_func) (uint32 code); * Some handy functions for Unicode-specific tests. */ static inline bool -is_valid_unicode_codepoint(pg_wchar c) +is_valid_unicode_codepoint(char32_t c) { return (c > 0 && c <= 0x10FFFF); } static inline bool -is_utf16_surrogate_first(pg_wchar c) +is_utf16_surrogate_first(char32_t c) { return (c >= 0xD800 && c <= 0xDBFF); } static inline bool -is_utf16_surrogate_second(pg_wchar c) +is_utf16_surrogate_second(char32_t c) { return (c >= 0xDC00 && c <= 0xDFFF); } -static inline pg_wchar -surrogate_pair_to_codepoint(pg_wchar first, pg_wchar second) +static inline char32_t +surrogate_pair_to_codepoint(char16_t first, char16_t second) { return ((first & 0x3FF) << 10) + 0x10000 + (second & 0x3FF); } @@ -561,20 +561,20 @@ surrogate_pair_to_codepoint(pg_wchar first, pg_wchar second) * * No error checks here, c must point to a long-enough string. */ -static inline pg_wchar +static inline char32_t utf8_to_unicode(const unsigned char *c) { if ((*c & 0x80) == 0) - return (pg_wchar) c[0]; + return (char32_t) c[0]; else if ((*c & 0xe0) == 0xc0) - return (pg_wchar) (((c[0] & 0x1f) << 6) | + return (char32_t) (((c[0] & 0x1f) << 6) | (c[1] & 0x3f)); else if ((*c & 0xf0) == 0xe0) - return (pg_wchar) (((c[0] & 0x0f) << 12) | + return (char32_t) (((c[0] & 0x0f) << 12) | ((c[1] & 0x3f) << 6) | (c[2] & 0x3f)); else if ((*c & 0xf8) == 0xf0) - return (pg_wchar) (((c[0] & 0x07) << 18) | + return (char32_t) (((c[0] & 0x07) << 18) | ((c[1] & 0x3f) << 12) | ((c[2] & 0x3f) << 6) | (c[3] & 0x3f)); @@ -588,7 +588,7 @@ utf8_to_unicode(const unsigned char *c) * unicode_utf8len(c) bytes available. */ static inline unsigned char * -unicode_to_utf8(pg_wchar c, unsigned char *utf8string) +unicode_to_utf8(char32_t c, unsigned char *utf8string) { if (c <= 0x7F) { @@ -620,7 +620,7 @@ unicode_to_utf8(pg_wchar c, unsigned char *utf8string) * Number of bytes needed to represent the given char in UTF8. */ static inline int -unicode_utf8len(pg_wchar c) +unicode_utf8len(char32_t c) { if (c <= 0x7F) return 1; @@ -676,8 +676,8 @@ extern int pg_valid_server_encoding(const char *name); extern bool is_encoding_supported_by_icu(int encoding); extern const char *get_encoding_name_for_icu(int encoding); -extern unsigned char *unicode_to_utf8(pg_wchar c, unsigned char *utf8string); -extern pg_wchar utf8_to_unicode(const unsigned char *c); +extern unsigned char *unicode_to_utf8(char32_t c, unsigned char *utf8string); +extern char32_t utf8_to_unicode(const unsigned char *c); extern bool pg_utf8_islegal(const unsigned char *source, int length); extern int pg_utf_mblen(const unsigned char *s); extern int pg_mule_mblen(const unsigned char *s); @@ -739,8 +739,8 @@ extern char *pg_server_to_client(const char *s, int len); extern char *pg_any_to_server(const char *s, int len, int encoding); extern char *pg_server_to_any(const char *s, int len, int encoding); -extern void pg_unicode_to_server(pg_wchar c, unsigned char *s); -extern bool pg_unicode_to_server_noerror(pg_wchar c, unsigned char *s); +extern void pg_unicode_to_server(char32_t c, unsigned char *s); +extern bool pg_unicode_to_server_noerror(char32_t c, unsigned char *s); extern unsigned short BIG5toCNS(unsigned short big5, unsigned char *lc); extern unsigned short CNStoBIG5(unsigned short cns, unsigned char lc); diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index a36653c37f9..18ae8f0d4bb 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -844,9 +844,15 @@ typedef struct ExecAuxRowMark typedef struct TupleHashEntryData *TupleHashEntry; typedef struct TupleHashTableData *TupleHashTable; +/* + * TupleHashEntryData is a slot in the tuplehash_hash table. If it's + * populated, it contains a pointer to a MinimalTuple that can also have + * associated "additional data". That's stored in the TupleHashTable's + * tuplescxt. + */ typedef struct TupleHashEntryData { - MinimalTuple firstTuple; /* copy of first tuple in this group */ + MinimalTuple firstTuple; /* -> copy of first tuple in this group */ uint32 status; /* hash status */ uint32 hash; /* hash value (cached) */ } TupleHashEntryData; @@ -861,13 +867,13 @@ typedef struct TupleHashEntryData typedef struct TupleHashTableData { - tuplehash_hash *hashtab; /* underlying hash table */ + tuplehash_hash *hashtab; /* underlying simplehash hash table */ int numCols; /* number of columns in lookup key */ AttrNumber *keyColIdx; /* attr numbers of key columns */ ExprState *tab_hash_expr; /* ExprState for hashing table datatype(s) */ ExprState *tab_eq_func; /* comparator for table datatype(s) */ Oid *tab_collations; /* collations for hash and comparison */ - MemoryContext tablecxt; /* memory context containing table */ + MemoryContext tuplescxt; /* memory context storing hashed tuples */ MemoryContext tempcxt; /* context for function evaluations */ Size additionalsize; /* size of additional data */ TupleTableSlot *tableslot; /* slot for referencing table entries */ @@ -1017,7 +1023,7 @@ typedef struct SubPlanState TupleHashTable hashnulls; /* hash table for rows with null(s) */ bool havehashrows; /* true if hashtable is not empty */ bool havenullrows; /* true if hashnulls is not empty */ - MemoryContext hashtablecxt; /* memory context containing hash tables */ + MemoryContext tuplesContext; /* context containing hash tables' tuples */ ExprContext *innerecontext; /* econtext for computing inner tuples */ int numCols; /* number of columns being hashed */ /* each of the remaining fields is an array of length numCols: */ @@ -1566,7 +1572,7 @@ typedef struct RecursiveUnionState FmgrInfo *hashfunctions; /* per-grouping-field hash fns */ MemoryContext tempContext; /* short-term context for comparisons */ TupleHashTable hashtable; /* hash table for tuples already seen */ - MemoryContext tableContext; /* memory context containing hash table */ + MemoryContext tuplesContext; /* context containing hash table's tuples */ } RecursiveUnionState; /* ---------------- @@ -2567,7 +2573,7 @@ typedef struct AggState bool table_filled; /* hash table filled yet? */ int num_hashes; MemoryContext hash_metacxt; /* memory for hash table bucket array */ - MemoryContext hash_tablecxt; /* memory for hash table entries */ + MemoryContext hash_tuplescxt; /* memory for hash table tuples */ struct LogicalTapeSet *hash_tapeset; /* tape set for hash spill tapes */ struct HashAggSpill *hash_spills; /* HashAggSpill for each grouping set, * exists only during first pass */ @@ -2866,7 +2872,7 @@ typedef struct SetOpState Oid *eqfuncoids; /* per-grouping-field equality fns */ FmgrInfo *hashfunctions; /* per-grouping-field hash fns */ TupleHashTable hashtable; /* hash table with one entry per group */ - MemoryContext tableContext; /* memory context containing hash table */ + MemoryContext tuplesContext; /* context containing hash table's tuples */ bool table_filled; /* hash table filled yet? */ TupleHashIterator hashiter; /* for iterating through hash table */ } SetOpState; diff --git a/src/include/nodes/tidbitmap.h b/src/include/nodes/tidbitmap.h index f54e61c7190..c24997d1c40 100644 --- a/src/include/nodes/tidbitmap.h +++ b/src/include/nodes/tidbitmap.h @@ -85,7 +85,7 @@ extern void tbm_free(TIDBitmap *tbm); extern void tbm_free_shared_area(dsa_area *dsa, dsa_pointer dp); extern void tbm_add_tuples(TIDBitmap *tbm, - const ItemPointer tids, int ntids, + const ItemPointerData *tids, int ntids, bool recheck); extern void tbm_add_page(TIDBitmap *tbm, BlockNumber pageno); diff --git a/src/include/partitioning/partbounds.h b/src/include/partitioning/partbounds.h index 083b6e3a88a..cf93f9e5bef 100644 --- a/src/include/partitioning/partbounds.h +++ b/src/include/partitioning/partbounds.h @@ -130,8 +130,8 @@ extern void check_default_partition_contents(Relation parent, extern int32 partition_rbound_datum_cmp(FmgrInfo *partsupfunc, Oid *partcollation, - Datum *rb_datums, PartitionRangeDatumKind *rb_kind, - Datum *tuple_datums, int n_tuple_datums); + const Datum *rb_datums, PartitionRangeDatumKind *rb_kind, + const Datum *tuple_datums, int n_tuple_datums); extern int partition_list_bsearch(FmgrInfo *partsupfunc, Oid *partcollation, PartitionBoundInfo boundinfo, @@ -139,7 +139,7 @@ extern int partition_list_bsearch(FmgrInfo *partsupfunc, extern int partition_range_datum_bsearch(FmgrInfo *partsupfunc, Oid *partcollation, PartitionBoundInfo boundinfo, - int nvalues, Datum *values, bool *is_equal); + int nvalues, const Datum *values, bool *is_equal); extern int partition_hash_bsearch(PartitionBoundInfo boundinfo, int modulus, int remainder); diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index c4dc5d72bdb..f52f14cc566 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -463,6 +463,9 @@ /* Define to 1 if you have the <termios.h> header file. */ #undef HAVE_TERMIOS_H +/* Define to 1 if you have the <uchar.h> header file. */ +#undef HAVE_UCHAR_H + /* Define to 1 if curl_global_init() is guaranteed to be thread-safe. */ #undef HAVE_THREADSAFE_CURL_GLOBAL_INIT @@ -796,10 +799,6 @@ #undef inline #endif -/* Define to keyword to use for C99 restrict support, or to nothing if not - supported */ -#undef pg_restrict - /* Define to the equivalent of the C99 'restrict' keyword, or to nothing if this is not supported. Do not define if restrict is supported directly. */ diff --git a/src/include/pgstat.h b/src/include/pgstat.h index bc8077cbae6..7ae503e71a2 100644 --- a/src/include/pgstat.h +++ b/src/include/pgstat.h @@ -212,7 +212,7 @@ typedef struct PgStat_TableXactStatus * ------------------------------------------------------------ */ -#define PGSTAT_FILE_FORMAT_ID 0x01A5BCB9 +#define PGSTAT_FILE_FORMAT_ID 0x01A5BCBA typedef struct PgStat_ArchiverStats { @@ -473,6 +473,7 @@ typedef struct PgStat_WalCounters PgStat_Counter wal_records; PgStat_Counter wal_fpi; uint64 wal_bytes; + uint64 wal_fpi_bytes; PgStat_Counter wal_buffers_full; } PgStat_WalCounters; diff --git a/src/include/replication/worker_internal.h b/src/include/replication/worker_internal.h index ae352f6e691..e23fa9a4514 100644 --- a/src/include/replication/worker_internal.h +++ b/src/include/replication/worker_internal.h @@ -254,7 +254,8 @@ extern PGDLLIMPORT bool InitializingApplyWorker; extern PGDLLIMPORT List *table_states_not_ready; extern void logicalrep_worker_attach(int slot); -extern LogicalRepWorker *logicalrep_worker_find(Oid subid, Oid relid, +extern LogicalRepWorker *logicalrep_worker_find(LogicalRepWorkerType wtype, + Oid subid, Oid relid, bool only_running); extern List *logicalrep_workers_find(Oid subid, bool only_running, bool acquire_lock); @@ -263,9 +264,11 @@ extern bool logicalrep_worker_launch(LogicalRepWorkerType wtype, Oid userid, Oid relid, dsm_handle subworker_dsm, bool retain_dead_tuples); -extern void logicalrep_worker_stop(Oid subid, Oid relid); +extern void logicalrep_worker_stop(LogicalRepWorkerType wtype, Oid subid, + Oid relid); extern void logicalrep_pa_worker_stop(ParallelApplyWorkerInfo *winfo); -extern void logicalrep_worker_wakeup(Oid subid, Oid relid); +extern void logicalrep_worker_wakeup(LogicalRepWorkerType wtype, Oid subid, + Oid relid); extern void logicalrep_worker_wakeup_ptr(LogicalRepWorker *worker); extern int logicalrep_sync_worker_count(Oid subid); diff --git a/src/include/storage/itemptr.h b/src/include/storage/itemptr.h index 2e251fb64ed..a74b3c8e2f4 100644 --- a/src/include/storage/itemptr.h +++ b/src/include/storage/itemptr.h @@ -217,8 +217,8 @@ ItemPointerSetMovedPartitions(ItemPointerData *pointer) * ---------------- */ -extern bool ItemPointerEquals(ItemPointer pointer1, ItemPointer pointer2); -extern int32 ItemPointerCompare(ItemPointer arg1, ItemPointer arg2); +extern bool ItemPointerEquals(const ItemPointerData *pointer1, const ItemPointerData *pointer2); +extern int32 ItemPointerCompare(const ItemPointerData *arg1, const ItemPointerData *arg2); extern void ItemPointerInc(ItemPointer pointer); extern void ItemPointerDec(ItemPointer pointer); diff --git a/src/include/storage/predicate.h b/src/include/storage/predicate.h index c1e3a4d9f64..8f5f0348a23 100644 --- a/src/include/storage/predicate.h +++ b/src/include/storage/predicate.h @@ -54,7 +54,7 @@ extern void SetSerializableTransactionSnapshot(Snapshot snapshot, extern void RegisterPredicateLockingXid(TransactionId xid); extern void PredicateLockRelation(Relation relation, Snapshot snapshot); extern void PredicateLockPage(Relation relation, BlockNumber blkno, Snapshot snapshot); -extern void PredicateLockTID(Relation relation, ItemPointer tid, Snapshot snapshot, +extern void PredicateLockTID(Relation relation, const ItemPointerData *tid, Snapshot snapshot, TransactionId tuple_xid); extern void PredicateLockPageSplit(Relation relation, BlockNumber oldblkno, BlockNumber newblkno); extern void PredicateLockPageCombine(Relation relation, BlockNumber oldblkno, BlockNumber newblkno); @@ -64,7 +64,7 @@ extern void ReleasePredicateLocks(bool isCommit, bool isReadOnlySafe); /* conflict detection (may also trigger rollback) */ extern bool CheckForSerializableConflictOutNeeded(Relation relation, Snapshot snapshot); extern void CheckForSerializableConflictOut(Relation relation, TransactionId xid, Snapshot snapshot); -extern void CheckForSerializableConflictIn(Relation relation, ItemPointer tid, BlockNumber blkno); +extern void CheckForSerializableConflictIn(Relation relation, const ItemPointerData *tid, BlockNumber blkno); extern void CheckTableForSerializableConflictIn(Relation relation); /* final rollback checking */ diff --git a/src/include/utils/array.h b/src/include/utils/array.h index 3383f16a3bb..67d11a78ba4 100644 --- a/src/include/utils/array.h +++ b/src/include/utils/array.h @@ -352,8 +352,8 @@ extern PGDLLIMPORT bool Array_nulls; * prototypes for functions defined in arrayfuncs.c */ extern void CopyArrayEls(ArrayType *array, - Datum *values, - bool *nulls, + const Datum *values, + const bool *nulls, int nitems, int typlen, bool typbyval, @@ -405,14 +405,14 @@ extern ArrayType *construct_empty_array(Oid elmtype); extern ExpandedArrayHeader *construct_empty_expanded_array(Oid element_type, MemoryContext parentcontext, ArrayMetaState *metacache); -extern void deconstruct_array(ArrayType *array, +extern void deconstruct_array(const ArrayType *array, Oid elmtype, int elmlen, bool elmbyval, char elmalign, Datum **elemsp, bool **nullsp, int *nelemsp); -extern void deconstruct_array_builtin(ArrayType *array, +extern void deconstruct_array_builtin(const ArrayType *array, Oid elmtype, Datum **elemsp, bool **nullsp, int *nelemsp); -extern bool array_contains_nulls(ArrayType *array); +extern bool array_contains_nulls(const ArrayType *array); extern ArrayBuildState *initArrayResult(Oid element_type, MemoryContext rcontext, bool subcontext); diff --git a/src/include/utils/guc_tables.h b/src/include/utils/guc_tables.h index 3de3d809545..bbfcc633014 100644 --- a/src/include/utils/guc_tables.h +++ b/src/include/utils/guc_tables.h @@ -132,6 +132,84 @@ typedef struct guc_stack config_var_value masked; /* SET value in a GUC_SET_LOCAL entry */ } GucStack; + +/* GUC records for specific variable types */ + +struct config_bool +{ + /* constant fields, must be set correctly in initial value: */ + bool *variable; + bool boot_val; + GucBoolCheckHook check_hook; + GucBoolAssignHook assign_hook; + GucShowHook show_hook; + /* variable fields, initialized at runtime: */ + bool reset_val; +}; + +struct config_int +{ + /* constant fields, must be set correctly in initial value: */ + int *variable; + int boot_val; + int min; + int max; + GucIntCheckHook check_hook; + GucIntAssignHook assign_hook; + GucShowHook show_hook; + /* variable fields, initialized at runtime: */ + int reset_val; +}; + +struct config_real +{ + /* constant fields, must be set correctly in initial value: */ + double *variable; + double boot_val; + double min; + double max; + GucRealCheckHook check_hook; + GucRealAssignHook assign_hook; + GucShowHook show_hook; + /* variable fields, initialized at runtime: */ + double reset_val; +}; + +/* + * A note about string GUCs: the boot_val is allowed to be NULL, which leads + * to the reset_val and the actual variable value (*variable) also being NULL. + * However, there is no way to set a NULL value subsequently using + * set_config_option or any other GUC API. Also, GUC APIs such as SHOW will + * display a NULL value as an empty string. Callers that choose to use a NULL + * boot_val should overwrite the setting later in startup, or else be careful + * that NULL doesn't have semantics that are visibly different from an empty + * string. + */ +struct config_string +{ + /* constant fields, must be set correctly in initial value: */ + char **variable; + const char *boot_val; + GucStringCheckHook check_hook; + GucStringAssignHook assign_hook; + GucShowHook show_hook; + /* variable fields, initialized at runtime: */ + char *reset_val; +}; + +struct config_enum +{ + /* constant fields, must be set correctly in initial value: */ + int *variable; + int boot_val; + const struct config_enum_entry *options; + GucEnumCheckHook check_hook; + GucEnumAssignHook assign_hook; + GucShowHook show_hook; + /* variable fields, initialized at runtime: */ + int reset_val; +}; + /* * Generic fields applicable to all types of variables * @@ -200,6 +278,16 @@ struct config_generic char *sourcefile; /* file current setting is from (NULL if not * set in config file) */ int sourceline; /* line in source file */ + + /* fields for specific variable types */ + union + { + struct config_bool _bool; + struct config_int _int; + struct config_real _real; + struct config_string _string; + struct config_enum _enum; + }; }; /* bit values in status field */ @@ -212,100 +300,14 @@ struct config_generic #define GUC_NEEDS_REPORT 0x0004 /* new value must be reported to client */ -/* GUC records for specific variable types */ - -struct config_bool -{ - struct config_generic gen; - /* constant fields, must be set correctly in initial value: */ - bool *variable; - bool boot_val; - GucBoolCheckHook check_hook; - GucBoolAssignHook assign_hook; - GucShowHook show_hook; - /* variable fields, initialized at runtime: */ - bool reset_val; -}; - -struct config_int -{ - struct config_generic gen; - /* constant fields, must be set correctly in initial value: */ - int *variable; - int boot_val; - int min; - int max; - GucIntCheckHook check_hook; - GucIntAssignHook assign_hook; - GucShowHook show_hook; - /* variable fields, initialized at runtime: */ - int reset_val; -}; - -struct config_real -{ - struct config_generic gen; - /* constant fields, must be set correctly in initial value: */ - double *variable; - double boot_val; - double min; - double max; - GucRealCheckHook check_hook; - GucRealAssignHook assign_hook; - GucShowHook show_hook; - /* variable fields, initialized at runtime: */ - double reset_val; -}; - -/* - * A note about string GUCs: the boot_val is allowed to be NULL, which leads - * to the reset_val and the actual variable value (*variable) also being NULL. - * However, there is no way to set a NULL value subsequently using - * set_config_option or any other GUC API. Also, GUC APIs such as SHOW will - * display a NULL value as an empty string. Callers that choose to use a NULL - * boot_val should overwrite the setting later in startup, or else be careful - * that NULL doesn't have semantics that are visibly different from an empty - * string. - */ -struct config_string -{ - struct config_generic gen; - /* constant fields, must be set correctly in initial value: */ - char **variable; - const char *boot_val; - GucStringCheckHook check_hook; - GucStringAssignHook assign_hook; - GucShowHook show_hook; - /* variable fields, initialized at runtime: */ - char *reset_val; -}; - -struct config_enum -{ - struct config_generic gen; - /* constant fields, must be set correctly in initial value: */ - int *variable; - int boot_val; - const struct config_enum_entry *options; - GucEnumCheckHook check_hook; - GucEnumAssignHook assign_hook; - GucShowHook show_hook; - /* variable fields, initialized at runtime: */ - int reset_val; -}; - /* constant tables corresponding to enums above and in guc.h */ extern PGDLLIMPORT const char *const config_group_names[]; extern PGDLLIMPORT const char *const config_type_names[]; extern PGDLLIMPORT const char *const GucContext_Names[]; extern PGDLLIMPORT const char *const GucSource_Names[]; -/* data arrays defining all the built-in GUC variables */ -extern PGDLLIMPORT struct config_bool ConfigureNamesBool[]; -extern PGDLLIMPORT struct config_int ConfigureNamesInt[]; -extern PGDLLIMPORT struct config_real ConfigureNamesReal[]; -extern PGDLLIMPORT struct config_string ConfigureNamesString[]; -extern PGDLLIMPORT struct config_enum ConfigureNamesEnum[]; +/* data array defining all the built-in GUC variables */ +extern PGDLLIMPORT struct config_generic ConfigureNames[]; /* lookup GUC variables, returning config_generic pointers */ extern struct config_generic *find_option(const char *name, @@ -326,7 +328,7 @@ extern struct config_generic **get_guc_variables(int *num_vars); extern void build_guc_variables(void); /* search in enum options */ -extern const char *config_enum_lookup_by_value(const struct config_enum *record, int val); +extern const char *config_enum_lookup_by_value(const struct config_generic *record, int val); extern bool config_enum_lookup_by_name(const struct config_enum *record, const char *value, int *retval); extern char *config_enum_get_options(const struct config_enum *record, diff --git a/src/include/utils/jsonb.h b/src/include/utils/jsonb.h index fecb33b9c67..ff30fbcf6df 100644 --- a/src/include/utils/jsonb.h +++ b/src/include/utils/jsonb.h @@ -426,9 +426,9 @@ extern char *JsonbUnquote(Jsonb *jb); extern bool JsonbExtractScalar(JsonbContainer *jbc, JsonbValue *res); extern const char *JsonbTypeName(JsonbValue *val); -extern Datum jsonb_set_element(Jsonb *jb, Datum *path, int path_len, +extern Datum jsonb_set_element(Jsonb *jb, const Datum *path, int path_len, JsonbValue *newval); -extern Datum jsonb_get_element(Jsonb *jb, Datum *path, int npath, +extern Datum jsonb_get_element(Jsonb *jb, const Datum *path, int npath, bool *isnull, bool as_text); extern bool to_jsonb_is_immutable(Oid typoid); extern Datum jsonb_build_object_worker(int nargs, const Datum *args, const bool *nulls, diff --git a/src/include/utils/tuplesort.h b/src/include/utils/tuplesort.h index ef79f259f93..0bf55902aa1 100644 --- a/src/include/utils/tuplesort.h +++ b/src/include/utils/tuplesort.h @@ -458,7 +458,7 @@ extern void tuplesort_puttupleslot(Tuplesortstate *state, TupleTableSlot *slot); extern void tuplesort_putheaptuple(Tuplesortstate *state, HeapTuple tup); extern void tuplesort_putindextuplevalues(Tuplesortstate *state, - Relation rel, ItemPointer self, + Relation rel, const ItemPointerData *self, const Datum *values, const bool *isnull); extern void tuplesort_putbrintuple(Tuplesortstate *state, BrinTuple *tuple, Size size); extern void tuplesort_putgintuple(Tuplesortstate *state, GinTuple *tuple, Size size); diff --git a/src/include/utils/xml.h b/src/include/utils/xml.h index 0d7a816b9f9..732dac47bc4 100644 --- a/src/include/utils/xml.h +++ b/src/include/utils/xml.h @@ -71,8 +71,8 @@ extern void xml_ereport(PgXmlErrorContext *errcxt, int level, int sqlcode, extern xmltype *xmlconcat(List *args); extern xmltype *xmlelement(XmlExpr *xexpr, - Datum *named_argvalue, bool *named_argnull, - Datum *argvalue, bool *argnull); + const Datum *named_argvalue, const bool *named_argnull, + const Datum *argvalue, const bool *argnull); extern xmltype *xmlparse(text *data, XmlOptionType xmloption_arg, bool preserve_whitespace); extern xmltype *xmlpi(const char *target, text *arg, bool arg_is_null, bool *result_is_null); extern xmltype *xmlroot(xmltype *data, text *version, int standalone); |
