diff options
Diffstat (limited to 'src/include')
24 files changed, 76 insertions, 46 deletions
diff --git a/src/include/Makefile b/src/include/Makefile index 6afa3cfe25..ea3b9245c0 100644 --- a/src/include/Makefile +++ b/src/include/Makefile @@ -20,7 +20,7 @@ all: pg_config.h pg_config_ext.h pg_config_os.h SUBDIRS = access bootstrap catalog commands common datatype \ executor fe_utils foreign \ lib libpq mb nodes optimizer parser pgxc postmaster regex replication \ - rewrite storage tcop snowball snowball/libstemmer tsearch \ + rewrite statistics storage tcop snowball snowball/libstemmer tsearch \ tsearch/dicts utils port port/atomics port/win32 port/win32_msvc \ port/win32_msvc/sys port/win32/arpa port/win32/netinet \ port/win32/sys portability gtm diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 06fff799af..8b2ec21509 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 201705141 +#define CATALOG_VERSION_NO 201706141 #endif diff --git a/src/include/catalog/pg_collation.h b/src/include/catalog/pg_collation.h index 1e44ce0949..901c0b5115 100644 --- a/src/include/catalog/pg_collation.h +++ b/src/include/catalog/pg_collation.h @@ -70,13 +70,13 @@ typedef FormData_pg_collation *Form_pg_collation; * ---------------- */ -DATA(insert OID = 100 ( default PGNSP PGUID d -1 "" "" 0 )); +DATA(insert OID = 100 ( default PGNSP PGUID d -1 "" "" _null_ )); DESCR("database's default collation"); #define DEFAULT_COLLATION_OID 100 -DATA(insert OID = 950 ( C PGNSP PGUID c -1 "C" "C" 0 )); +DATA(insert OID = 950 ( C PGNSP PGUID c -1 "C" "C" _null_ )); DESCR("standard C collation"); #define C_COLLATION_OID 950 -DATA(insert OID = 951 ( POSIX PGNSP PGUID c -1 "POSIX" "POSIX" 0 )); +DATA(insert OID = 951 ( POSIX PGNSP PGUID c -1 "POSIX" "POSIX" _null_ )); DESCR("standard POSIX collation"); #define POSIX_COLLATION_OID 951 diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index e06ed6cc77..cafdb8990a 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -4872,9 +4872,9 @@ DATA(insert OID = 4209 ( to_tsvector PGNSP PGUID 12 100 0 0 0 f f f f t f s s DESCR("transform jsonb to tsvector"); DATA(insert OID = 4210 ( to_tsvector PGNSP PGUID 12 100 0 0 0 f f f f t f s s 1 0 3614 "114" _null_ _null_ _null_ _null_ _null_ json_to_tsvector _null_ _null_ _null_ )); DESCR("transform json to tsvector"); -DATA(insert OID = 4211 ( to_tsvector PGNSP PGUID 12 100 0 0 0 f f f f t f s s 2 0 3614 "3734 3802" _null_ _null_ _null_ _null_ _null_ jsonb_to_tsvector_byid _null_ _null_ _null_ )); +DATA(insert OID = 4211 ( to_tsvector PGNSP PGUID 12 100 0 0 0 f f f f t f i s 2 0 3614 "3734 3802" _null_ _null_ _null_ _null_ _null_ jsonb_to_tsvector_byid _null_ _null_ _null_ )); DESCR("transform jsonb to tsvector"); -DATA(insert OID = 4212 ( to_tsvector PGNSP PGUID 12 100 0 0 0 f f f f t f s s 2 0 3614 "3734 114" _null_ _null_ _null_ _null_ _null_ json_to_tsvector_byid _null_ _null_ _null_ )); +DATA(insert OID = 4212 ( to_tsvector PGNSP PGUID 12 100 0 0 0 f f f f t f i s 2 0 3614 "3734 114" _null_ _null_ _null_ _null_ _null_ json_to_tsvector_byid _null_ _null_ _null_ )); DESCR("transform json to tsvector"); DATA(insert OID = 3752 ( tsvector_update_trigger PGNSP PGUID 12 1 0 0 0 f f f f f f v s 0 0 2279 "" _null_ _null_ _null_ _null_ _null_ tsvector_update_trigger_byid _null_ _null_ _null_ )); diff --git a/src/include/catalog/pg_subscription_rel.h b/src/include/catalog/pg_subscription_rel.h index 391f96b76e..f5f6191676 100644 --- a/src/include/catalog/pg_subscription_rel.h +++ b/src/include/catalog/pg_subscription_rel.h @@ -71,7 +71,7 @@ typedef struct SubscriptionRelState } SubscriptionRelState; extern Oid SetSubscriptionRelState(Oid subid, Oid relid, char state, - XLogRecPtr sublsn); + XLogRecPtr sublsn, bool update_only); extern char GetSubscriptionRelState(Oid subid, Oid relid, XLogRecPtr *sublsn, bool missing_ok); extern void RemoveSubscriptionRel(Oid subid, Oid relid); diff --git a/src/include/commands/defrem.h b/src/include/commands/defrem.h index 79f3be36e4..5dd14b43d3 100644 --- a/src/include/commands/defrem.h +++ b/src/include/commands/defrem.h @@ -27,6 +27,7 @@ extern ObjectAddress DefineIndex(Oid relationId, Oid indexRelationId, bool is_alter_table, bool check_rights, + bool check_not_in_use, bool skip_build, bool quiet); extern Oid ReindexIndex(RangeVar *indexRelation, int options); diff --git a/src/include/lib/simplehash.h b/src/include/lib/simplehash.h index a35addf636..47dd0bc4ee 100644 --- a/src/include/lib/simplehash.h +++ b/src/include/lib/simplehash.h @@ -214,12 +214,12 @@ SH_COMPUTE_PARAMETERS(SH_TYPE * tb, uint32 newsize) /* supporting zero sized hashes would complicate matters */ size = Max(newsize, 2); - /* round up size to the next power of 2, that's the bucketing works */ + /* round up size to the next power of 2, that's how bucketing works */ size = sh_pow2(size); Assert(size <= SH_MAX_SIZE); /* - * Verify allocation of ->data is possible on platform, without + * Verify that allocation of ->data is possible on this platform, without * overflowing Size. */ if ((((uint64) sizeof(SH_ELEMENT_TYPE)) * size) >= MaxAllocHugeSize) @@ -234,8 +234,8 @@ SH_COMPUTE_PARAMETERS(SH_TYPE * tb, uint32 newsize) tb->sizemask = tb->size - 1; /* - * Compute growth threshold here and after growing the table, to make - * computations during insert cheaper. + * Compute the next threshold at which we need to grow the hash table + * again. */ if (tb->size == SH_MAX_SIZE) tb->grow_threshold = ((double) tb->size) * SH_MAX_FILLFACTOR; @@ -696,7 +696,7 @@ SH_DELETE(SH_TYPE * tb, SH_KEY_TYPE key) * or an element at its optimal position is encountered. * * While that sounds expensive, the average chain length is short, - * and deletions would otherwise require toombstones. + * and deletions would otherwise require tombstones. */ while (true) { diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index 343cbd9692..8ac73dd403 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -24,6 +24,8 @@ #ifndef MISCADMIN_H #define MISCADMIN_H +#include <signal.h> + #include "pgtime.h" /* for pg_time_t */ @@ -82,6 +84,7 @@ extern PGDLLIMPORT volatile bool InterruptPending; extern PGDLLIMPORT volatile bool QueryCancelPending; extern PGDLLIMPORT volatile bool ProcDiePending; extern PGDLLIMPORT volatile bool IdleInTransactionSessionTimeoutPending; +extern PGDLLIMPORT volatile sig_atomic_t ConfigReloadPending; extern volatile bool ClientConnectionLost; @@ -278,6 +281,8 @@ extern void restore_stack_base(pg_stack_base_t base); extern void check_stack_depth(void); extern bool stack_is_too_deep(void); +extern void PostgresSigHupHandler(SIGNAL_ARGS); + /* in tcop/utility.c */ extern void PreventCommandIfReadOnly(const char *cmdname); extern void PreventCommandIfParallelMode(const char *cmdname); diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 8d4e58ca89..fb3684eb5c 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -957,6 +957,11 @@ typedef struct RangeTblEntry /* * Fields valid for a plain relation RTE (else zero): + * + * As a special case, RTE_NAMEDTUPLESTORE can also set relid to indicate + * that the tuple format of the tuplestore is the same as the referenced + * relation. This allows plans referencing AFTER trigger transition + * tables to be invalidated if the underlying table is altered. */ Oid relid; /* OID of the relation */ char relkind; /* relation kind (see pg_class.relkind) */ @@ -1017,16 +1022,23 @@ typedef struct RangeTblEntry bool self_reference; /* is this a recursive self-reference? */ /* - * Fields valid for values and CTE RTEs (else NIL): + * Fields valid for table functions, values, CTE and ENR RTEs (else NIL): * * We need these for CTE RTEs so that the types of self-referential * columns are well-defined. For VALUES RTEs, storing these explicitly * saves having to re-determine the info by scanning the values_lists. + * For ENRs, we store the types explicitly here (we could get the + * information from the catalogs if 'relid' was supplied, but we'd still + * need these for TupleDesc-based ENRs, so we might as well always store + * the type info here). */ List *coltypes; /* OID list of column type OIDs */ List *coltypmods; /* integer list of column typmods */ List *colcollations; /* OID list of column collation OIDs */ + /* + * Fields valid for ENR RTEs (else NULL/zero): + */ char *enrname; /* name of ephemeral named relation */ double enrtuples; /* estimated or actual from caller */ @@ -3520,7 +3532,6 @@ typedef enum AlterSubscriptionType ALTER_SUBSCRIPTION_OPTIONS, ALTER_SUBSCRIPTION_CONNECTION, ALTER_SUBSCRIPTION_PUBLICATION, - ALTER_SUBSCRIPTION_PUBLICATION_REFRESH, ALTER_SUBSCRIPTION_REFRESH, ALTER_SUBSCRIPTION_ENABLED } AlterSubscriptionType; diff --git a/src/include/optimizer/geqo.h b/src/include/optimizer/geqo.h index 6b09c4e195..be65c054e1 100644 --- a/src/include/optimizer/geqo.h +++ b/src/include/optimizer/geqo.h @@ -31,7 +31,7 @@ #define GEQO_DEBUG */ -/* recombination mechanism */ +/* choose one recombination mechanism here */ /* #define ERX #define PMX diff --git a/src/include/optimizer/predtest.h b/src/include/optimizer/predtest.h index 658a86cc15..748cd35611 100644 --- a/src/include/optimizer/predtest.h +++ b/src/include/optimizer/predtest.h @@ -17,9 +17,9 @@ #include "nodes/primnodes.h" -extern bool predicate_implied_by(List *predicate_list, - List *restrictinfo_list); -extern bool predicate_refuted_by(List *predicate_list, - List *restrictinfo_list); +extern bool predicate_implied_by(List *predicate_list, List *clause_list, + bool clause_is_check); +extern bool predicate_refuted_by(List *predicate_list, List *clause_list, + bool clause_is_check); #endif /* PREDTEST_H */ diff --git a/src/include/parser/parse_func.h b/src/include/parser/parse_func.h index e0dad6ac10..c684217e33 100644 --- a/src/include/parser/parse_func.h +++ b/src/include/parser/parse_func.h @@ -31,7 +31,7 @@ typedef enum extern Node *ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, - FuncCall *fn, int location); + Node *last_srf, FuncCall *fn, int location); extern FuncDetailCode func_get_detail(List *funcname, List *fargs, List *fargnames, @@ -67,7 +67,8 @@ extern Oid LookupFuncWithArgs(ObjectWithArgs *func, extern Oid LookupAggWithArgs(ObjectWithArgs *agg, bool noError); -extern void check_srf_call_placement(ParseState *pstate, int location); +extern void check_srf_call_placement(ParseState *pstate, Node *last_srf, + int location); extern void check_pg_get_expr_args(ParseState *pstate, Oid fnoid, List *args); #endif /* PARSE_FUNC_H */ diff --git a/src/include/parser/parse_node.h b/src/include/parser/parse_node.h index 0b54840e29..6a3507f3b1 100644 --- a/src/include/parser/parse_node.h +++ b/src/include/parser/parse_node.h @@ -157,6 +157,9 @@ typedef Node *(*CoerceParamHook) (ParseState *pstate, Param *param, * p_hasAggs, p_hasWindowFuncs, etc: true if we've found any of the indicated * constructs in the query. * + * p_last_srf: the set-returning FuncExpr or OpExpr most recently found in + * the query, or NULL if none. + * * p_pre_columnref_hook, etc: optional parser hook functions for modifying the * interpretation of ColumnRefs and ParamRefs. * @@ -199,6 +202,8 @@ struct ParseState bool p_hasSubLinks; bool p_hasModifyingCTE; + Node *p_last_srf; /* most recent set-returning func/op found */ + /* * Optional hook functions for parser callbacks. These are null unless * set up by the caller of make_parsestate. diff --git a/src/include/parser/parse_oper.h b/src/include/parser/parse_oper.h index d783b37f0f..ab3c4aa62f 100644 --- a/src/include/parser/parse_oper.h +++ b/src/include/parser/parse_oper.h @@ -59,7 +59,7 @@ extern Oid oprfuncid(Operator op); /* Build expression tree for an operator invocation */ extern Expr *make_op(ParseState *pstate, List *opname, - Node *ltree, Node *rtree, int location); + Node *ltree, Node *rtree, Node *last_srf, int location); extern Expr *make_scalar_array_op(ParseState *pstate, List *opname, bool useOr, Node *ltree, Node *rtree, int location); diff --git a/src/include/postgres.h b/src/include/postgres.h index 87df7844f4..7426a253d2 100644 --- a/src/include/postgres.h +++ b/src/include/postgres.h @@ -689,7 +689,7 @@ DatumGetFloat4(Datum X) float4 retval; } myunion; - myunion.value = GET_4_BYTES(X); + myunion.value = DatumGetInt32(X); return myunion.retval; } #else @@ -714,7 +714,7 @@ Float4GetDatum(float4 X) } myunion; myunion.value = X; - return SET_4_BYTES(myunion.retval); + return Int32GetDatum(myunion.retval); } #else extern Datum Float4GetDatum(float4 X); @@ -737,7 +737,7 @@ DatumGetFloat8(Datum X) float8 retval; } myunion; - myunion.value = GET_8_BYTES(X); + myunion.value = DatumGetInt64(X); return myunion.retval; } #else @@ -763,7 +763,7 @@ Float8GetDatum(float8 X) } myunion; myunion.value = X; - return SET_8_BYTES(myunion.retval); + return Int64GetDatum(myunion.retval); } #else extern Datum Float8GetDatum(float8 X); diff --git a/src/include/replication/logicallauncher.h b/src/include/replication/logicallauncher.h index d202a237e7..4f3e89e061 100644 --- a/src/include/replication/logicallauncher.h +++ b/src/include/replication/logicallauncher.h @@ -24,4 +24,6 @@ extern void ApplyLauncherShmemInit(void); extern void ApplyLauncherWakeupAtCommit(void); extern void AtEOXact_ApplyLauncher(bool isCommit); +extern bool IsLogicalLauncher(void); + #endif /* LOGICALLAUNCHER_H */ diff --git a/src/include/replication/logicalworker.h b/src/include/replication/logicalworker.h index 3e0affa190..5877a930f6 100644 --- a/src/include/replication/logicalworker.h +++ b/src/include/replication/logicalworker.h @@ -14,4 +14,6 @@ extern void ApplyWorkerMain(Datum main_arg); +extern bool IsLogicalWorker(void); + #endif /* LOGICALWORKER_H */ diff --git a/src/include/replication/walsender.h b/src/include/replication/walsender.h index 99f12377e0..c50e450ec2 100644 --- a/src/include/replication/walsender.h +++ b/src/include/replication/walsender.h @@ -44,7 +44,9 @@ extern void WalSndSignals(void); extern Size WalSndShmemSize(void); extern void WalSndShmemInit(void); extern void WalSndWakeup(void); +extern void WalSndInitStopping(void); extern void WalSndWaitStopping(void); +extern void HandleWalSndInitStopping(void); extern void WalSndRqstFileReload(void); /* diff --git a/src/include/replication/worker_internal.h b/src/include/replication/worker_internal.h index 0654461305..2bfff5c120 100644 --- a/src/include/replication/worker_internal.h +++ b/src/include/replication/worker_internal.h @@ -67,8 +67,6 @@ extern Subscription *MySubscription; extern LogicalRepWorker *MyLogicalRepWorker; extern bool in_remote_transaction; -extern volatile sig_atomic_t got_SIGHUP; -extern volatile sig_atomic_t got_SIGTERM; extern void logicalrep_worker_attach(int slot); extern LogicalRepWorker *logicalrep_worker_find(Oid subid, Oid relid, @@ -81,8 +79,6 @@ extern void logicalrep_worker_wakeup_ptr(LogicalRepWorker *worker); extern int logicalrep_sync_worker_count(Oid subid); -extern void logicalrep_worker_sighup(SIGNAL_ARGS); -extern void logicalrep_worker_sigterm(SIGNAL_ARGS); extern char *LogicalRepSyncTableStart(XLogRecPtr *origin_startpos); void process_syncing_tables(XLogRecPtr current_lsn); void invalidate_syncing_table_states(Datum arg, int cacheid, diff --git a/src/include/storage/predicate.h b/src/include/storage/predicate.h index 8f9ea29917..941ba7119e 100644 --- a/src/include/storage/predicate.h +++ b/src/include/storage/predicate.h @@ -14,6 +14,7 @@ #ifndef PREDICATE_H #define PREDICATE_H +#include "storage/lock.h" #include "utils/relcache.h" #include "utils/snapshot.h" @@ -46,7 +47,8 @@ extern bool PageIsPredicateLocked(Relation relation, BlockNumber blkno); /* predicate lock maintenance */ extern Snapshot GetSerializableTransactionSnapshot(Snapshot snapshot); extern void SetSerializableTransactionSnapshot(Snapshot snapshot, - TransactionId sourcexid); + VirtualTransactionId *sourcevxid, + int sourcepid); extern void RegisterPredicateLockingXid(TransactionId xid); extern void PredicateLockRelation(Relation relation, Snapshot snapshot); extern void PredicateLockPage(Relation relation, BlockNumber blkno, Snapshot snapshot); diff --git a/src/include/storage/procarray.h b/src/include/storage/procarray.h index bc46229b42..7dfe37f881 100644 --- a/src/include/storage/procarray.h +++ b/src/include/storage/procarray.h @@ -108,7 +108,7 @@ extern int GetMaxSnapshotSubxidCount(void); extern Snapshot GetSnapshotData(Snapshot snapshot, bool latest); extern bool ProcArrayInstallImportedXmin(TransactionId xmin, - TransactionId sourcexid); + VirtualTransactionId *sourcevxid); extern bool ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc); extern void ProcArrayCheckXminConsistency(TransactionId global_xmin); extern void SetLatestCompletedXid(TransactionId latestCompletedXid); diff --git a/src/include/storage/procsignal.h b/src/include/storage/procsignal.h index 67cb913829..d58c1bede9 100644 --- a/src/include/storage/procsignal.h +++ b/src/include/storage/procsignal.h @@ -46,6 +46,8 @@ typedef enum PROCSIG_PGXCPOOL_REFRESH, /* refresh local view of connection handles */ #endif PROCSIG_PARALLEL_MESSAGE, /* message from cooperating parallel backend */ + PROCSIG_WALSND_INIT_STOPPING, /* ask walsenders to prepare for + * shutdown */ /* Recovery conflict reasons */ PROCSIG_RECOVERY_CONFLICT_DATABASE, diff --git a/src/include/storage/shm_toc.h b/src/include/storage/shm_toc.h index ae0a3878fe..9175a472d8 100644 --- a/src/include/storage/shm_toc.h +++ b/src/include/storage/shm_toc.h @@ -22,9 +22,9 @@ #ifndef SHM_TOC_H #define SHM_TOC_H -#include "storage/shmem.h" +#include "storage/shmem.h" /* for add_size() */ -struct shm_toc; +/* shm_toc is an opaque type known only within shm_toc.c */ typedef struct shm_toc shm_toc; extern shm_toc *shm_toc_create(uint64 magic, void *address, Size nbytes); @@ -32,11 +32,13 @@ extern shm_toc *shm_toc_attach(uint64 magic, void *address); extern void *shm_toc_allocate(shm_toc *toc, Size nbytes); extern Size shm_toc_freespace(shm_toc *toc); extern void shm_toc_insert(shm_toc *toc, uint64 key, void *address); -extern void *shm_toc_lookup(shm_toc *toc, uint64 key); +extern void *shm_toc_lookup(shm_toc *toc, uint64 key, bool noError); /* * Tools for estimating how large a chunk of shared memory will be needed - * to store a TOC and its dependent objects. + * to store a TOC and its dependent objects. Note: we don't really support + * large numbers of keys, but it's convenient to declare number_of_keys + * as a Size anyway. */ typedef struct { @@ -47,11 +49,10 @@ typedef struct #define shm_toc_initialize_estimator(e) \ ((e)->space_for_chunks = 0, (e)->number_of_keys = 0) #define shm_toc_estimate_chunk(e, sz) \ - ((e)->space_for_chunks = add_size((e)->space_for_chunks, \ - BUFFERALIGN((sz)))) + ((e)->space_for_chunks = add_size((e)->space_for_chunks, BUFFERALIGN(sz))) #define shm_toc_estimate_keys(e, cnt) \ - ((e)->number_of_keys = add_size((e)->number_of_keys, (cnt))) + ((e)->number_of_keys = add_size((e)->number_of_keys, cnt)) -extern Size shm_toc_estimate(shm_toc_estimator *); +extern Size shm_toc_estimate(shm_toc_estimator *e); #endif /* SHM_TOC_H */ diff --git a/src/include/utils/syscache.h b/src/include/utils/syscache.h index 2bbc93a975..67cc6f4c23 100644 --- a/src/include/utils/syscache.h +++ b/src/include/utils/syscache.h @@ -84,22 +84,22 @@ enum SysCacheIdentifier PARTRELID, PROCNAMEARGSNSP, PROCOID, + PUBLICATIONNAME, + PUBLICATIONOID, + PUBLICATIONREL, + PUBLICATIONRELMAP, RANGETYPE, RELNAMENSP, RELOID, REPLORIGIDENT, REPLORIGNAME, - PUBLICATIONOID, - PUBLICATIONNAME, - PUBLICATIONREL, - PUBLICATIONRELMAP, RULERELNAME, SEQRELID, STATEXTNAMENSP, STATEXTOID, STATRELATTINH, - SUBSCRIPTIONOID, SUBSCRIPTIONNAME, + SUBSCRIPTIONOID, SUBSCRIPTIONRELMAP, TABLESPACEOID, TRFOID, |