mirror of
https://github.com/postgres/postgres.git
synced 2025-04-20 00:42:27 +03:00
Post-feature-freeze pgindent run.
Discussion: https://postgr.es/m/15719.1523984266@sss.pgh.pa.us
This commit is contained in:
parent
f83bf385c1
commit
bdf46af748
@ -227,12 +227,12 @@ bt_index_check_internal(Oid indrelid, bool parentcheck, bool heapallindexed)
|
||||
* with heap relation locked first to prevent deadlocking). In hot
|
||||
* standby mode this will raise an error when parentcheck is true.
|
||||
*
|
||||
* There is no need for the usual indcheckxmin usability horizon test here,
|
||||
* even in the heapallindexed case, because index undergoing verification
|
||||
* only needs to have entries for a new transaction snapshot. (If this is
|
||||
* a parentcheck verification, there is no question about committed or
|
||||
* recently dead heap tuples lacking index entries due to concurrent
|
||||
* activity.)
|
||||
* There is no need for the usual indcheckxmin usability horizon test
|
||||
* here, even in the heapallindexed case, because index undergoing
|
||||
* verification only needs to have entries for a new transaction snapshot.
|
||||
* (If this is a parentcheck verification, there is no question about
|
||||
* committed or recently dead heap tuples lacking index entries due to
|
||||
* concurrent activity.)
|
||||
*/
|
||||
indrel = index_open(indrelid, lockmode);
|
||||
|
||||
@ -366,8 +366,8 @@ bt_check_every_level(Relation rel, Relation heaprel, bool readonly,
|
||||
* index fingerprinting should have reached all tuples returned by
|
||||
* IndexBuildHeapScan().
|
||||
*
|
||||
* In readonly case, we also check for problems with missing downlinks.
|
||||
* A second Bloom filter is used for this.
|
||||
* In readonly case, we also check for problems with missing
|
||||
* downlinks. A second Bloom filter is used for this.
|
||||
*/
|
||||
if (!state->readonly)
|
||||
{
|
||||
@ -378,13 +378,13 @@ bt_check_every_level(Relation rel, Relation heaprel, bool readonly,
|
||||
* READ COMMITTED mode. A new snapshot is guaranteed to have all
|
||||
* the entries it requires in the index.
|
||||
*
|
||||
* We must defend against the possibility that an old xact snapshot
|
||||
* was returned at higher isolation levels when that snapshot is
|
||||
* not safe for index scans of the target index. This is possible
|
||||
* when the snapshot sees tuples that are before the index's
|
||||
* indcheckxmin horizon. Throwing an error here should be very
|
||||
* rare. It doesn't seem worth using a secondary snapshot to avoid
|
||||
* this.
|
||||
* We must defend against the possibility that an old xact
|
||||
* snapshot was returned at higher isolation levels when that
|
||||
* snapshot is not safe for index scans of the target index. This
|
||||
* is possible when the snapshot sees tuples that are before the
|
||||
* index's indcheckxmin horizon. Throwing an error here should be
|
||||
* very rare. It doesn't seem worth using a secondary snapshot to
|
||||
* avoid this.
|
||||
*/
|
||||
if (IsolationUsesXactSnapshot() && rel->rd_index->indcheckxmin &&
|
||||
!TransactionIdPrecedes(HeapTupleHeaderGetXmin(rel->rd_indextuple->t_data),
|
||||
@ -401,8 +401,8 @@ bt_check_every_level(Relation rel, Relation heaprel, bool readonly,
|
||||
/*
|
||||
* Extra readonly downlink check.
|
||||
*
|
||||
* In readonly case, we know that there cannot be a concurrent page
|
||||
* split or a concurrent page deletion, which gives us the
|
||||
* In readonly case, we know that there cannot be a concurrent
|
||||
* page split or a concurrent page deletion, which gives us the
|
||||
* opportunity to verify that every non-ignorable page had a
|
||||
* downlink one level up. We must be tolerant of interrupted page
|
||||
* splits and page deletions, though. This is taken care of in
|
||||
@ -491,9 +491,9 @@ bt_check_every_level(Relation rel, Relation heaprel, bool readonly,
|
||||
}
|
||||
|
||||
/*
|
||||
* Create our own scan for IndexBuildHeapScan(), rather than getting it
|
||||
* to do so for us. This is required so that we can actually use the
|
||||
* MVCC snapshot registered earlier in !readonly case.
|
||||
* Create our own scan for IndexBuildHeapScan(), rather than getting
|
||||
* it to do so for us. This is required so that we can actually use
|
||||
* the MVCC snapshot registered earlier in !readonly case.
|
||||
*
|
||||
* Note that IndexBuildHeapScan() calls heap_endscan() for us.
|
||||
*/
|
||||
@ -607,10 +607,10 @@ bt_check_level_from_leftmost(BtreeCheckState *state, BtreeLevel level)
|
||||
{
|
||||
/*
|
||||
* Since there cannot be a concurrent VACUUM operation in readonly
|
||||
* mode, and since a page has no links within other pages (siblings
|
||||
* and parent) once it is marked fully deleted, it should be
|
||||
* impossible to land on a fully deleted page in readonly mode.
|
||||
* See bt_downlink_check() for further details.
|
||||
* mode, and since a page has no links within other pages
|
||||
* (siblings and parent) once it is marked fully deleted, it
|
||||
* should be impossible to land on a fully deleted page in
|
||||
* readonly mode. See bt_downlink_check() for further details.
|
||||
*
|
||||
* The bt_downlink_check() P_ISDELETED() check is repeated here so
|
||||
* that pages that are only reachable through sibling links get
|
||||
@ -799,8 +799,8 @@ bt_target_page_check(BtreeCheckState *state)
|
||||
P_ISLEAF(topaque) ? "leaf" : "internal", state->targetblock);
|
||||
|
||||
/*
|
||||
* Check the number of attributes in high key. Note, rightmost page doesn't
|
||||
* contain a high key, so nothing to check
|
||||
* Check the number of attributes in high key. Note, rightmost page
|
||||
* doesn't contain a high key, so nothing to check
|
||||
*/
|
||||
if (!P_RIGHTMOST(topaque) &&
|
||||
!_bt_check_natts(state->rel, state->target, P_HIKEY))
|
||||
@ -845,8 +845,8 @@ bt_target_page_check(BtreeCheckState *state)
|
||||
|
||||
/*
|
||||
* lp_len should match the IndexTuple reported length exactly, since
|
||||
* lp_len is completely redundant in indexes, and both sources of tuple
|
||||
* length are MAXALIGN()'d. nbtree does not use lp_len all that
|
||||
* lp_len is completely redundant in indexes, and both sources of
|
||||
* tuple length are MAXALIGN()'d. nbtree does not use lp_len all that
|
||||
* frequently, and is surprisingly tolerant of corrupt lp_len fields.
|
||||
*/
|
||||
if (tupsize != ItemIdGetLength(itemid))
|
||||
@ -1462,14 +1462,15 @@ bt_downlink_missing_check(BtreeCheckState *state)
|
||||
* page split in passing, when it notices that the left sibling page is
|
||||
* P_INCOMPLETE_SPLIT().
|
||||
*
|
||||
* In general, VACUUM is not prepared for there to be no downlink to a page
|
||||
* that it deletes. This is the main reason why the lack of a downlink can
|
||||
* be reported as corruption here. It's not obvious that an invalid
|
||||
* missing downlink can result in wrong answers to queries, though, since
|
||||
* index scans that land on the child may end up consistently moving right.
|
||||
* The handling of concurrent page splits (and page deletions) within
|
||||
* _bt_moveright() cannot distinguish inconsistencies that last for a
|
||||
* moment from inconsistencies that are permanent and irrecoverable.
|
||||
* In general, VACUUM is not prepared for there to be no downlink to a
|
||||
* page that it deletes. This is the main reason why the lack of a
|
||||
* downlink can be reported as corruption here. It's not obvious that an
|
||||
* invalid missing downlink can result in wrong answers to queries,
|
||||
* though, since index scans that land on the child may end up
|
||||
* consistently moving right. The handling of concurrent page splits (and
|
||||
* page deletions) within _bt_moveright() cannot distinguish
|
||||
* inconsistencies that last for a moment from inconsistencies that are
|
||||
* permanent and irrecoverable.
|
||||
*
|
||||
* VACUUM isn't even prepared to delete pages that have no downlink due to
|
||||
* an incomplete page split, but it can detect and reason about that case
|
||||
@ -1498,8 +1499,8 @@ bt_downlink_missing_check(BtreeCheckState *state)
|
||||
|
||||
/*
|
||||
* Target is probably the "top parent" of a multi-level page deletion.
|
||||
* We'll need to descend the subtree to make sure that descendant pages are
|
||||
* consistent with that, though.
|
||||
* We'll need to descend the subtree to make sure that descendant pages
|
||||
* are consistent with that, though.
|
||||
*
|
||||
* If the target page (which must be non-ignorable) is a leaf page, then
|
||||
* clearly it can't be the top parent. The lack of a downlink is probably
|
||||
@ -1562,14 +1563,14 @@ bt_downlink_missing_check(BtreeCheckState *state)
|
||||
* bt_downlink_check() does not visit pages reachable through negative
|
||||
* infinity items. Besides, bt_downlink_check() is unwilling to descend
|
||||
* multiple levels. (The similar bt_downlink_check() P_ISDELETED() check
|
||||
* within bt_check_level_from_leftmost() won't reach the page either, since
|
||||
* the leaf's live siblings should have their sibling links updated to
|
||||
* bypass the deletion target page when it is marked fully dead.)
|
||||
* within bt_check_level_from_leftmost() won't reach the page either,
|
||||
* since the leaf's live siblings should have their sibling links updated
|
||||
* to bypass the deletion target page when it is marked fully dead.)
|
||||
*
|
||||
* If this error is raised, it might be due to a previous multi-level page
|
||||
* deletion that failed to realize that it wasn't yet safe to mark the leaf
|
||||
* page as fully dead. A "dangling downlink" will still remain when this
|
||||
* happens. The fact that the dangling downlink's page (the leaf's
|
||||
* deletion that failed to realize that it wasn't yet safe to mark the
|
||||
* leaf page as fully dead. A "dangling downlink" will still remain when
|
||||
* this happens. The fact that the dangling downlink's page (the leaf's
|
||||
* parent/ancestor page) lacked a downlink is incidental.
|
||||
*/
|
||||
if (P_ISDELETED(copaque))
|
||||
@ -1583,14 +1584,14 @@ bt_downlink_missing_check(BtreeCheckState *state)
|
||||
(uint32) state->targetlsn)));
|
||||
|
||||
/*
|
||||
* Iff leaf page is half-dead, its high key top parent link should point to
|
||||
* what VACUUM considered to be the top parent page at the instant it was
|
||||
* interrupted. Provided the high key link actually points to the target
|
||||
* page, the missing downlink we detected is consistent with there having
|
||||
* been an interrupted multi-level page deletion. This means that the
|
||||
* subtree with the target page at its root (a page deletion chain) is in a
|
||||
* consistent state, enabling VACUUM to resume deleting the entire chain
|
||||
* the next time it encounters the half-dead leaf page.
|
||||
* Iff leaf page is half-dead, its high key top parent link should point
|
||||
* to what VACUUM considered to be the top parent page at the instant it
|
||||
* was interrupted. Provided the high key link actually points to the
|
||||
* target page, the missing downlink we detected is consistent with there
|
||||
* having been an interrupted multi-level page deletion. This means that
|
||||
* the subtree with the target page at its root (a page deletion chain) is
|
||||
* in a consistent state, enabling VACUUM to resume deleting the entire
|
||||
* chain the next time it encounters the half-dead leaf page.
|
||||
*/
|
||||
if (P_ISHALFDEAD(copaque) && !P_RIGHTMOST(copaque))
|
||||
{
|
||||
@ -1681,16 +1682,17 @@ bt_tuple_present_callback(Relation index, HeapTuple htup, Datum *values,
|
||||
* are assumed immutable. While the LP_DEAD bit is mutable in leaf pages,
|
||||
* that's ItemId metadata, which was not fingerprinted. (There will often
|
||||
* be some dead-to-everyone IndexTuples fingerprinted by the Bloom filter,
|
||||
* but we only try to detect the absence of needed tuples, so that's okay.)
|
||||
* but we only try to detect the absence of needed tuples, so that's
|
||||
* okay.)
|
||||
*
|
||||
* Note that we rely on deterministic index_form_tuple() TOAST compression.
|
||||
* If index_form_tuple() was ever enhanced to compress datums out-of-line,
|
||||
* or otherwise varied when or how compression was applied, our assumption
|
||||
* would break, leading to false positive reports of corruption. It's also
|
||||
* possible that non-pivot tuples could in the future have alternative
|
||||
* equivalent representations (e.g. by using the INDEX_ALT_TID_MASK bit).
|
||||
* For now, we don't decompress/normalize toasted values as part of
|
||||
* fingerprinting.
|
||||
* Note that we rely on deterministic index_form_tuple() TOAST
|
||||
* compression. If index_form_tuple() was ever enhanced to compress datums
|
||||
* out-of-line, or otherwise varied when or how compression was applied,
|
||||
* our assumption would break, leading to false positive reports of
|
||||
* corruption. It's also possible that non-pivot tuples could in the
|
||||
* future have alternative equivalent representations (e.g. by using the
|
||||
* INDEX_ALT_TID_MASK bit). For now, we don't decompress/normalize toasted
|
||||
* values as part of fingerprinting.
|
||||
*/
|
||||
itup = index_form_tuple(RelationGetDescr(index), values, isnull);
|
||||
itup->t_tid = htup->t_self;
|
||||
@ -1905,19 +1907,19 @@ palloc_btree_page(BtreeCheckState *state, BlockNumber blocknum)
|
||||
* Sanity checks for number of items on page.
|
||||
*
|
||||
* As noted at the beginning of _bt_binsrch(), an internal page must have
|
||||
* children, since there must always be a negative infinity downlink (there
|
||||
* may also be a highkey). In the case of non-rightmost leaf pages, there
|
||||
* must be at least a highkey.
|
||||
* children, since there must always be a negative infinity downlink
|
||||
* (there may also be a highkey). In the case of non-rightmost leaf
|
||||
* pages, there must be at least a highkey.
|
||||
*
|
||||
* This is correct when pages are half-dead, since internal pages are never
|
||||
* half-dead, and leaf pages must have a high key when half-dead (the
|
||||
* rightmost page can never be deleted). It's also correct with fully
|
||||
* deleted pages: _bt_unlink_halfdead_page() doesn't change anything about
|
||||
* the target page other than setting the page as fully dead, and setting
|
||||
* its xact field. In particular, it doesn't change the sibling links in
|
||||
* the deletion target itself, since they're required when index scans land
|
||||
* on the deletion target, and then need to move right (or need to move
|
||||
* left, in the case of backward index scans).
|
||||
* This is correct when pages are half-dead, since internal pages are
|
||||
* never half-dead, and leaf pages must have a high key when half-dead
|
||||
* (the rightmost page can never be deleted). It's also correct with
|
||||
* fully deleted pages: _bt_unlink_halfdead_page() doesn't change anything
|
||||
* about the target page other than setting the page as fully dead, and
|
||||
* setting its xact field. In particular, it doesn't change the sibling
|
||||
* links in the deletion target itself, since they're required when index
|
||||
* scans land on the deletion target, and then need to move right (or need
|
||||
* to move left, in the case of backward index scans).
|
||||
*/
|
||||
maxoffset = PageGetMaxOffsetNumber(page);
|
||||
if (maxoffset > MaxIndexTuplesPerPage)
|
||||
|
@ -483,8 +483,12 @@ GIN_SUPPORT(anyenum, false, leftmostvalue_enum, gin_enum_cmp)
|
||||
static Datum
|
||||
leftmostvalue_uuid(void)
|
||||
{
|
||||
/* palloc0 will create the UUID with all zeroes: "00000000-0000-0000-0000-000000000000" */
|
||||
/*
|
||||
* palloc0 will create the UUID with all zeroes:
|
||||
* "00000000-0000-0000-0000-000000000000"
|
||||
*/
|
||||
pg_uuid_t *retval = (pg_uuid_t *) palloc0(sizeof(pg_uuid_t));
|
||||
|
||||
return UUIDPGetDatum(retval);
|
||||
}
|
||||
|
||||
@ -493,7 +497,8 @@ GIN_SUPPORT(uuid, false, leftmostvalue_uuid, uuid_cmp)
|
||||
static Datum
|
||||
leftmostvalue_name(void)
|
||||
{
|
||||
NameData* result = (NameData *) palloc0(NAMEDATALEN);
|
||||
NameData *result = (NameData *) palloc0(NAMEDATALEN);
|
||||
|
||||
return NameGetDatum(result);
|
||||
}
|
||||
|
||||
|
@ -1362,6 +1362,7 @@ g_cube_distance(PG_FUNCTION_ARGS)
|
||||
{
|
||||
/* dimension index */
|
||||
int index = (coord - 1) / 2;
|
||||
|
||||
/* whether this is upper bound (lower bound otherwise) */
|
||||
bool upper = ((coord - 1) % 2 == 1);
|
||||
|
||||
@ -1597,6 +1598,7 @@ cube_coord_llur(PG_FUNCTION_ARGS)
|
||||
{
|
||||
/* dimension index */
|
||||
int index = (coord - 1) / 2;
|
||||
|
||||
/* whether this is upper bound (lower bound otherwise) */
|
||||
bool upper = ((coord - 1) % 2 == 1);
|
||||
|
||||
@ -1615,8 +1617,8 @@ cube_coord_llur(PG_FUNCTION_ARGS)
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Return zero if coordinate is out of bound. That reproduces logic of
|
||||
* how cubes with low dimension number are expanded during GiST
|
||||
* Return zero if coordinate is out of bound. That reproduces logic
|
||||
* of how cubes with low dimension number are expanded during GiST
|
||||
* indexing.
|
||||
*/
|
||||
result = 0.0;
|
||||
|
@ -33,6 +33,7 @@ JsonbValue_to_SV(JsonbValue *jbv)
|
||||
char *str = DatumGetCString(DirectFunctionCall1(numeric_out,
|
||||
NumericGetDatum(jbv->val.numeric)));
|
||||
SV *result = newSVnv(SvNV(cstr2sv(str)));
|
||||
|
||||
pfree(str);
|
||||
return result;
|
||||
}
|
||||
@ -42,6 +43,7 @@ JsonbValue_to_SV(JsonbValue *jbv)
|
||||
char *str = pnstrdup(jbv->val.string.val,
|
||||
jbv->val.string.len);
|
||||
SV *result = cstr2sv(str);
|
||||
|
||||
pfree(str);
|
||||
return result;
|
||||
}
|
||||
|
@ -373,9 +373,10 @@ PLyObject_ToJsonbValue(PyObject *obj, JsonbParseState **jsonb_state, bool is_ele
|
||||
out->type = jbvNull;
|
||||
else if (PyString_Check(obj) || PyUnicode_Check(obj))
|
||||
PLyString_ToJsonbValue(obj, out);
|
||||
|
||||
/*
|
||||
* PyNumber_Check() returns true for booleans, so boolean check should come
|
||||
* first.
|
||||
* PyNumber_Check() returns true for booleans, so boolean check should
|
||||
* come first.
|
||||
*/
|
||||
else if (PyBool_Check(obj))
|
||||
{
|
||||
|
@ -292,7 +292,11 @@ gtrgm_consistent(PG_FUNCTION_ARGS)
|
||||
case SimilarityStrategyNumber:
|
||||
case WordSimilarityStrategyNumber:
|
||||
case StrictWordSimilarityStrategyNumber:
|
||||
/* Similarity search is exact. (Strict) word similarity search is inexact */
|
||||
|
||||
/*
|
||||
* Similarity search is exact. (Strict) word similarity search is
|
||||
* inexact
|
||||
*/
|
||||
*recheck = (strategy != SimilarityStrategyNumber);
|
||||
|
||||
nlimit = index_strategy_get_limit(strategy);
|
||||
|
@ -500,9 +500,9 @@ iterate_word_similarity(int *trg2indexes,
|
||||
word_similarity_threshold;
|
||||
|
||||
/*
|
||||
* Consider first trigram as initial lower bount for strict word similarity,
|
||||
* or initialize it later with first trigram present for plain word
|
||||
* similarity.
|
||||
* Consider first trigram as initial lower bount for strict word
|
||||
* similarity, or initialize it later with first trigram present for plain
|
||||
* word similarity.
|
||||
*/
|
||||
lower = (flags & WORD_SIMILARITY_STRICT) ? 0 : -1;
|
||||
|
||||
@ -597,8 +597,8 @@ iterate_word_similarity(int *trg2indexes,
|
||||
smlr_max = Max(smlr_max, smlr_cur);
|
||||
|
||||
/*
|
||||
* if we only check that word similarity is greater than
|
||||
* threshold we do not need to calculate a maximum similarity.
|
||||
* if we only check that word similarity is greater than threshold
|
||||
* we do not need to calculate a maximum similarity.
|
||||
*/
|
||||
if ((flags & WORD_SIMILARITY_CHECK_ONLY) && smlr_max >= threshold)
|
||||
break;
|
||||
|
@ -4918,8 +4918,8 @@ add_paths_with_pathkeys_for_rel(PlannerInfo *root, RelOptInfo *rel,
|
||||
&rows, &width, &startup_cost, &total_cost);
|
||||
|
||||
/*
|
||||
* The EPQ path must be at least as well sorted as the path itself,
|
||||
* in case it gets used as input to a mergejoin.
|
||||
* The EPQ path must be at least as well sorted as the path itself, in
|
||||
* case it gets used as input to a mergejoin.
|
||||
*/
|
||||
sorted_epq_path = epq_path;
|
||||
if (sorted_epq_path != NULL &&
|
||||
|
@ -1685,8 +1685,8 @@ slot_getsomeattrs(TupleTableSlot *slot, int attnum)
|
||||
attno = slot->tts_nvalid;
|
||||
|
||||
/*
|
||||
* If tuple doesn't have all the atts indicated by attnum, read the
|
||||
* rest as NULLs or missing values
|
||||
* If tuple doesn't have all the atts indicated by attnum, read the rest
|
||||
* as NULLs or missing values
|
||||
*/
|
||||
if (attno < attnum)
|
||||
slot_getmissingattrs(slot, attno, attnum);
|
||||
|
@ -489,8 +489,8 @@ index_truncate_tuple(TupleDesc sourceDescriptor, IndexTuple source,
|
||||
Assert(IndexTupleSize(truncated) <= IndexTupleSize(source));
|
||||
|
||||
/*
|
||||
* Cannot leak memory here, TupleDescCopy() doesn't allocate any
|
||||
* inner structure, so, plain pfree() should clean all allocated memory
|
||||
* Cannot leak memory here, TupleDescCopy() doesn't allocate any inner
|
||||
* structure, so, plain pfree() should clean all allocated memory
|
||||
*/
|
||||
pfree(truncdesc);
|
||||
|
||||
|
@ -1512,12 +1512,12 @@ index_generic_reloptions(Datum reloptions, bool validate)
|
||||
|
||||
idxopts = allocateReloptStruct(sizeof(GenericIndexOpts), options, numoptions);
|
||||
|
||||
fillRelOptions((void *)idxopts, sizeof(GenericIndexOpts), options, numoptions,
|
||||
fillRelOptions((void *) idxopts, sizeof(GenericIndexOpts), options, numoptions,
|
||||
validate, tab, lengthof(tab));
|
||||
|
||||
pfree(options);
|
||||
|
||||
return (bytea*) idxopts;
|
||||
return (bytea *) idxopts;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1812,8 +1812,8 @@ createPostingTree(Relation index, ItemPointerData *items, uint32 nitems,
|
||||
blkno = BufferGetBlockNumber(buffer);
|
||||
|
||||
/*
|
||||
* Copy a predicate lock from entry tree leaf (containing posting list)
|
||||
* to posting tree.
|
||||
* Copy a predicate lock from entry tree leaf (containing posting list) to
|
||||
* posting tree.
|
||||
*/
|
||||
PredicateLockPageSplit(index, BufferGetBlockNumber(entrybuffer), blkno);
|
||||
|
||||
|
@ -42,8 +42,8 @@ static void
|
||||
GinPredicateLockPage(Relation index, BlockNumber blkno, Snapshot snapshot)
|
||||
{
|
||||
/*
|
||||
* When fast update is on then no need in locking pages, because we
|
||||
* anyway need to lock the whole index.
|
||||
* When fast update is on then no need in locking pages, because we anyway
|
||||
* need to lock the whole index.
|
||||
*/
|
||||
if (!GinGetUseFastUpdate(index))
|
||||
PredicateLockPage(index, blkno, snapshot);
|
||||
@ -426,8 +426,8 @@ restartScanEntry:
|
||||
entry->buffer = stack->buffer;
|
||||
|
||||
/*
|
||||
* Predicate lock visited posting tree page, following pages
|
||||
* will be locked by moveRightIfItNeeded or entryLoadMoreItems
|
||||
* Predicate lock visited posting tree page, following pages will
|
||||
* be locked by moveRightIfItNeeded or entryLoadMoreItems
|
||||
*/
|
||||
GinPredicateLockPage(ginstate->index, BufferGetBlockNumber(entry->buffer), snapshot);
|
||||
|
||||
@ -1779,9 +1779,9 @@ scanPendingInsert(IndexScanDesc scan, TIDBitmap *tbm, int64 *ntids)
|
||||
UnlockReleaseBuffer(metabuffer);
|
||||
|
||||
/*
|
||||
* If fast update is enabled, we acquire a predicate lock on the entire
|
||||
* relation as fast update postpones the insertion of tuples into index
|
||||
* structure due to which we can't detect rw conflicts.
|
||||
* If fast update is enabled, we acquire a predicate lock on the
|
||||
* entire relation as fast update postpones the insertion of tuples
|
||||
* into index structure due to which we can't detect rw conflicts.
|
||||
*/
|
||||
if (GinGetUseFastUpdate(scan->indexRelation))
|
||||
PredicateLockRelation(scan->indexRelation, scan->xs_snapshot);
|
||||
|
@ -519,12 +519,12 @@ gininsert(Relation index, Datum *values, bool *isnull,
|
||||
|
||||
/*
|
||||
* With fastupdate on each scan and each insert begin with access to
|
||||
* pending list, so it effectively lock entire index. In this case
|
||||
* we aquire predicate lock and check for conflicts over index relation,
|
||||
* pending list, so it effectively lock entire index. In this case we
|
||||
* aquire predicate lock and check for conflicts over index relation,
|
||||
* and hope that it will reduce locking overhead.
|
||||
*
|
||||
* Do not use GinCheckForSerializableConflictIn() here, because
|
||||
* it will do nothing (it does actual work only with fastupdate off).
|
||||
* Do not use GinCheckForSerializableConflictIn() here, because it
|
||||
* will do nothing (it does actual work only with fastupdate off).
|
||||
* Check for conflicts for entire index.
|
||||
*/
|
||||
CheckForSerializableConflictIn(index, NULL, InvalidBuffer);
|
||||
|
@ -1220,8 +1220,8 @@ gistinserttuples(GISTInsertState *state, GISTInsertStack *stack,
|
||||
bool is_split;
|
||||
|
||||
/*
|
||||
* Check for any rw conflicts (in serialisation isolation level)
|
||||
* just before we intend to modify the page
|
||||
* Check for any rw conflicts (in serialisation isolation level) just
|
||||
* before we intend to modify the page
|
||||
*/
|
||||
CheckForSerializableConflictIn(state->r, NULL, stack->buffer);
|
||||
|
||||
|
@ -3460,7 +3460,7 @@ simple_heap_delete(Relation relation, ItemPointer tid)
|
||||
result = heap_delete(relation, tid,
|
||||
GetCurrentCommandId(true), InvalidSnapshot,
|
||||
true /* wait for commit */ ,
|
||||
&hufd, false /* changingPart */);
|
||||
&hufd, false /* changingPart */ );
|
||||
switch (result)
|
||||
{
|
||||
case HeapTupleSelfUpdated:
|
||||
@ -4483,7 +4483,8 @@ heap_tuple_attr_equals(TupleDesc tupdesc, int attrnum,
|
||||
* functional index. Compare the new and old values of the indexed
|
||||
* expression to see if we are able to use a HOT update or not.
|
||||
*/
|
||||
static bool ProjIndexIsUnchanged(Relation relation, HeapTuple oldtup, HeapTuple newtup)
|
||||
static bool
|
||||
ProjIndexIsUnchanged(Relation relation, HeapTuple oldtup, HeapTuple newtup)
|
||||
{
|
||||
ListCell *l;
|
||||
List *indexoidlist = RelationGetIndexList(relation);
|
||||
@ -4496,6 +4497,7 @@ static bool ProjIndexIsUnchanged(Relation relation, HeapTuple oldtup, HeapTuple
|
||||
Datum new_values[INDEX_MAX_KEYS];
|
||||
bool new_isnull[INDEX_MAX_KEYS];
|
||||
int indexno = 0;
|
||||
|
||||
econtext->ecxt_scantuple = slot;
|
||||
|
||||
foreach(l, indexoidlist)
|
||||
@ -4532,6 +4534,7 @@ static bool ProjIndexIsUnchanged(Relation relation, HeapTuple oldtup, HeapTuple
|
||||
else if (!old_isnull[i])
|
||||
{
|
||||
Form_pg_attribute att = TupleDescAttr(RelationGetDescr(indexDesc), i);
|
||||
|
||||
if (!datumIsEqual(old_values[i], new_values[i], att->attbyval, att->attlen))
|
||||
{
|
||||
equals = false;
|
||||
@ -6533,8 +6536,8 @@ FreezeMultiXactId(MultiXactId multi, uint16 t_infomask,
|
||||
/*
|
||||
* This old multi cannot possibly have members still running, but
|
||||
* verify just in case. If it was a locker only, it can be removed
|
||||
* without any further consideration; but if it contained an update, we
|
||||
* might need to preserve it.
|
||||
* without any further consideration; but if it contained an update,
|
||||
* we might need to preserve it.
|
||||
*/
|
||||
if (MultiXactIdIsRunning(multi,
|
||||
HEAP_XMAX_IS_LOCKED_ONLY(t_infomask)))
|
||||
@ -6681,8 +6684,8 @@ FreezeMultiXactId(MultiXactId multi, uint16 t_infomask,
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Not in progress, not committed -- must be aborted or crashed;
|
||||
* we can ignore it.
|
||||
* Not in progress, not committed -- must be aborted or
|
||||
* crashed; we can ignore it.
|
||||
*/
|
||||
}
|
||||
|
||||
@ -9275,6 +9278,7 @@ heap_redo(XLogReaderState *record)
|
||||
heap_xlog_update(record, false);
|
||||
break;
|
||||
case XLOG_HEAP_TRUNCATE:
|
||||
|
||||
/*
|
||||
* TRUNCATE is a no-op because the actions are already logged as
|
||||
* SMGR WAL records. TRUNCATE WAL record only exists for logical
|
||||
|
@ -132,16 +132,16 @@ _bt_doinsert(Relation rel, IndexTuple itup,
|
||||
* rightmost leaf, has enough free space to accommodate a new entry and
|
||||
* the insertion key is strictly greater than the first key in this page,
|
||||
* then we can safely conclude that the new key will be inserted in the
|
||||
* cached block. So we simply search within the cached block and insert the
|
||||
* key at the appropriate location. We call it a fastpath.
|
||||
* cached block. So we simply search within the cached block and insert
|
||||
* the key at the appropriate location. We call it a fastpath.
|
||||
*
|
||||
* Testing has revealed, though, that the fastpath can result in increased
|
||||
* contention on the exclusive-lock on the rightmost leaf page. So we
|
||||
* conditionally check if the lock is available. If it's not available then
|
||||
* we simply abandon the fastpath and take the regular path. This makes
|
||||
* sense because unavailability of the lock also signals that some other
|
||||
* backend might be concurrently inserting into the page, thus reducing our
|
||||
* chances to finding an insertion place in this page.
|
||||
* conditionally check if the lock is available. If it's not available
|
||||
* then we simply abandon the fastpath and take the regular path. This
|
||||
* makes sense because unavailability of the lock also signals that some
|
||||
* other backend might be concurrently inserting into the page, thus
|
||||
* reducing our chances to finding an insertion place in this page.
|
||||
*/
|
||||
top:
|
||||
fastpath = false;
|
||||
@ -155,8 +155,8 @@ top:
|
||||
/*
|
||||
* Conditionally acquire exclusive lock on the buffer before doing any
|
||||
* checks. If we don't get the lock, we simply follow slowpath. If we
|
||||
* do get the lock, this ensures that the index state cannot change, as
|
||||
* far as the rightmost part of the index is concerned.
|
||||
* do get the lock, this ensures that the index state cannot change,
|
||||
* as far as the rightmost part of the index is concerned.
|
||||
*/
|
||||
buf = ReadBuffer(rel, RelationGetTargetBlock(rel));
|
||||
|
||||
@ -173,8 +173,8 @@ top:
|
||||
|
||||
/*
|
||||
* Check if the page is still the rightmost leaf page, has enough
|
||||
* free space to accommodate the new tuple, and the insertion
|
||||
* scan key is strictly greater than the first key on the page.
|
||||
* free space to accommodate the new tuple, and the insertion scan
|
||||
* key is strictly greater than the first key on the page.
|
||||
*/
|
||||
if (P_ISLEAF(lpageop) && P_RIGHTMOST(lpageop) &&
|
||||
!P_IGNORE(lpageop) &&
|
||||
@ -207,8 +207,8 @@ top:
|
||||
ReleaseBuffer(buf);
|
||||
|
||||
/*
|
||||
* If someone's holding a lock, it's likely to change anyway,
|
||||
* so don't try again until we get an updated rightmost leaf.
|
||||
* If someone's holding a lock, it's likely to change anyway, so
|
||||
* don't try again until we get an updated rightmost leaf.
|
||||
*/
|
||||
RelationSetTargetBlock(rel, InvalidBlockNumber);
|
||||
}
|
||||
@ -882,15 +882,15 @@ _bt_insertonpg(Relation rel,
|
||||
Buffer rbuf;
|
||||
|
||||
/*
|
||||
* If we're here then a pagesplit is needed. We should never reach here
|
||||
* if we're using the fastpath since we should have checked for all the
|
||||
* required conditions, including the fact that this page has enough
|
||||
* freespace. Note that this routine can in theory deal with the
|
||||
* situation where a NULL stack pointer is passed (that's what would
|
||||
* happen if the fastpath is taken), like it does during crash
|
||||
* If we're here then a pagesplit is needed. We should never reach
|
||||
* here if we're using the fastpath since we should have checked for
|
||||
* all the required conditions, including the fact that this page has
|
||||
* enough freespace. Note that this routine can in theory deal with
|
||||
* the situation where a NULL stack pointer is passed (that's what
|
||||
* would happen if the fastpath is taken), like it does during crash
|
||||
* recovery. But that path is much slower, defeating the very purpose
|
||||
* of the optimization. The following assertion should protect us from
|
||||
* any future code changes that invalidate those assumptions.
|
||||
* of the optimization. The following assertion should protect us
|
||||
* from any future code changes that invalidate those assumptions.
|
||||
*
|
||||
* Note that whenever we fail to take the fastpath, we clear the
|
||||
* cached block. Checking for a valid cached block at this point is
|
||||
@ -1093,7 +1093,8 @@ _bt_insertonpg(Relation rel,
|
||||
* We do this after dropping locks on all buffers. So the information
|
||||
* about whether the insertion block is still the rightmost block or
|
||||
* not may have changed in between. But we will deal with that during
|
||||
* next insert operation. No special care is required while setting it.
|
||||
* next insert operation. No special care is required while setting
|
||||
* it.
|
||||
*/
|
||||
if (BlockNumberIsValid(cachedBlock) &&
|
||||
_bt_getrootheight(rel) >= BTREE_FASTPATH_MIN_LEVEL)
|
||||
|
@ -897,10 +897,10 @@ _bt_buildadd(BTWriteState *wstate, BTPageState *state, IndexTuple itup)
|
||||
/*
|
||||
* Truncate any non-key attributes from high key on leaf level
|
||||
* (i.e. truncate on leaf level if we're building an INCLUDE
|
||||
* index). This is only done at the leaf level because
|
||||
* downlinks in internal pages are either negative infinity
|
||||
* items, or get their contents from copying from one level
|
||||
* down. See also: _bt_split().
|
||||
* index). This is only done at the leaf level because downlinks
|
||||
* in internal pages are either negative infinity items, or get
|
||||
* their contents from copying from one level down. See also:
|
||||
* _bt_split().
|
||||
*
|
||||
* Since the truncated tuple is probably smaller than the
|
||||
* original, it cannot just be copied in place (besides, we want
|
||||
@ -908,11 +908,11 @@ _bt_buildadd(BTWriteState *wstate, BTPageState *state, IndexTuple itup)
|
||||
* original high key, and add our own truncated high key at the
|
||||
* same offset.
|
||||
*
|
||||
* Note that the page layout won't be changed very much. oitup
|
||||
* is already located at the physical beginning of tuple space,
|
||||
* so we only shift the line pointer array back and forth, and
|
||||
* overwrite the latter portion of the space occupied by the
|
||||
* original tuple. This is fairly cheap.
|
||||
* Note that the page layout won't be changed very much. oitup is
|
||||
* already located at the physical beginning of tuple space, so we
|
||||
* only shift the line pointer array back and forth, and overwrite
|
||||
* the latter portion of the space occupied by the original tuple.
|
||||
* This is fairly cheap.
|
||||
*/
|
||||
truncated = _bt_nonkey_truncate(wstate->index, oitup);
|
||||
truncsz = IndexTupleSize(truncated);
|
||||
|
@ -2105,8 +2105,8 @@ _bt_nonkey_truncate(Relation rel, IndexTuple itup)
|
||||
IndexTuple truncated;
|
||||
|
||||
/*
|
||||
* We should only ever truncate leaf index tuples, which must have both key
|
||||
* and non-key attributes. It's never okay to truncate a second time.
|
||||
* We should only ever truncate leaf index tuples, which must have both
|
||||
* key and non-key attributes. It's never okay to truncate a second time.
|
||||
*/
|
||||
Assert(BTreeTupleGetNAtts(itup, rel) ==
|
||||
IndexRelationGetNumberOfAttributes(rel));
|
||||
@ -2147,6 +2147,7 @@ _bt_check_natts(Relation rel, Page page, OffsetNumber offnum)
|
||||
|
||||
Assert(offnum >= FirstOffsetNumber &&
|
||||
offnum <= PageGetMaxOffsetNumber(page));
|
||||
|
||||
/*
|
||||
* Mask allocated for number of keys in index tuple must be able to fit
|
||||
* maximum possible number of index attributes
|
||||
@ -2184,19 +2185,19 @@ _bt_check_natts(Relation rel, Page page, OffsetNumber offnum)
|
||||
{
|
||||
/*
|
||||
* The first tuple on any internal page (possibly the first after
|
||||
* its high key) is its negative infinity tuple. Negative infinity
|
||||
* tuples are always truncated to zero attributes. They are a
|
||||
* particular kind of pivot tuple.
|
||||
* its high key) is its negative infinity tuple. Negative
|
||||
* infinity tuples are always truncated to zero attributes. They
|
||||
* are a particular kind of pivot tuple.
|
||||
*
|
||||
* The number of attributes won't be explicitly represented if the
|
||||
* negative infinity tuple was generated during a page split that
|
||||
* occurred with a version of Postgres before v11. There must be a
|
||||
* problem when there is an explicit representation that is
|
||||
* occurred with a version of Postgres before v11. There must be
|
||||
* a problem when there is an explicit representation that is
|
||||
* non-zero, or when there is no explicit representation and the
|
||||
* tuple is evidently not a pre-pg_upgrade tuple.
|
||||
*
|
||||
* Prior to v11, downlinks always had P_HIKEY as their offset. Use
|
||||
* that to decide if the tuple is a pre-v11 tuple.
|
||||
* Prior to v11, downlinks always had P_HIKEY as their offset.
|
||||
* Use that to decide if the tuple is a pre-v11 tuple.
|
||||
*/
|
||||
return BTreeTupleGetNAtts(itup, rel) == 0 ||
|
||||
((itup->t_info & INDEX_ALT_TID_MASK) == 0 &&
|
||||
|
@ -1908,11 +1908,12 @@ spgdoinsert(Relation index, SpGistState *state,
|
||||
/*
|
||||
* Prepare the leaf datum to insert.
|
||||
*
|
||||
* If an optional "compress" method is provided, then call it to form
|
||||
* the leaf datum from the input datum. Otherwise store the input datum as
|
||||
* is. Since we don't use index_form_tuple in this AM, we have to make sure
|
||||
* value to be inserted is not toasted; FormIndexDatum doesn't guarantee
|
||||
* that. But we assume the "compress" method to return an untoasted value.
|
||||
* If an optional "compress" method is provided, then call it to form the
|
||||
* leaf datum from the input datum. Otherwise store the input datum as
|
||||
* is. Since we don't use index_form_tuple in this AM, we have to make
|
||||
* sure value to be inserted is not toasted; FormIndexDatum doesn't
|
||||
* guarantee that. But we assume the "compress" method to return an
|
||||
* untoasted value.
|
||||
*/
|
||||
if (!isnull)
|
||||
{
|
||||
|
@ -119,9 +119,9 @@ spgvalidate(Oid opclassoid)
|
||||
configOutRighttype = procform->amprocrighttype;
|
||||
|
||||
/*
|
||||
* When leaf and attribute types are the same, compress function
|
||||
* is not required and we set corresponding bit in functionset
|
||||
* for later group consistency check.
|
||||
* When leaf and attribute types are the same, compress
|
||||
* function is not required and we set corresponding bit in
|
||||
* functionset for later group consistency check.
|
||||
*/
|
||||
if (!OidIsValid(configOut.leafType) ||
|
||||
configOut.leafType == configIn.attType)
|
||||
|
@ -3267,8 +3267,8 @@ bool
|
||||
IsInTransactionBlock(bool isTopLevel)
|
||||
{
|
||||
/*
|
||||
* Return true on same conditions that would make PreventInTransactionBlock
|
||||
* error out
|
||||
* Return true on same conditions that would make
|
||||
* PreventInTransactionBlock error out
|
||||
*/
|
||||
if (IsTransactionBlock())
|
||||
return true;
|
||||
@ -5448,7 +5448,7 @@ XactLogAbortRecord(TimestampTz abort_time,
|
||||
}
|
||||
|
||||
/* dump transaction origin information only for abort prepared */
|
||||
if ( (replorigin_session_origin != InvalidRepOriginId) &&
|
||||
if ((replorigin_session_origin != InvalidRepOriginId) &&
|
||||
TransactionIdIsValid(twophase_xid) &&
|
||||
XLogLogicalInfoActive())
|
||||
{
|
||||
|
@ -10656,10 +10656,9 @@ do_pg_start_backup(const char *backupidstr, bool fast, TimeLineID *starttli_p,
|
||||
* Mark that start phase has correctly finished for an exclusive backup.
|
||||
* Session-level locks are updated as well to reflect that state.
|
||||
*
|
||||
* Note that CHECK_FOR_INTERRUPTS() must not occur while updating
|
||||
* backup counters and session-level lock. Otherwise they can be
|
||||
* updated inconsistently, and which might cause do_pg_abort_backup()
|
||||
* to fail.
|
||||
* Note that CHECK_FOR_INTERRUPTS() must not occur while updating backup
|
||||
* counters and session-level lock. Otherwise they can be updated
|
||||
* inconsistently, and which might cause do_pg_abort_backup() to fail.
|
||||
*/
|
||||
if (exclusive)
|
||||
{
|
||||
@ -10904,11 +10903,11 @@ do_pg_stop_backup(char *labelfile, bool waitforarchive, TimeLineID *stoptli_p)
|
||||
/*
|
||||
* Clean up session-level lock.
|
||||
*
|
||||
* You might think that WALInsertLockRelease() can be called
|
||||
* before cleaning up session-level lock because session-level
|
||||
* lock doesn't need to be protected with WAL insertion lock.
|
||||
* But since CHECK_FOR_INTERRUPTS() can occur in it,
|
||||
* session-level lock must be cleaned up before it.
|
||||
* You might think that WALInsertLockRelease() can be called before
|
||||
* cleaning up session-level lock because session-level lock doesn't need
|
||||
* to be protected with WAL insertion lock. But since
|
||||
* CHECK_FOR_INTERRUPTS() can occur in it, session-level lock must be
|
||||
* cleaned up before it.
|
||||
*/
|
||||
sessionBackupState = SESSION_BACKUP_NONE;
|
||||
|
||||
@ -11042,6 +11041,7 @@ do_pg_stop_backup(char *labelfile, bool waitforarchive, TimeLineID *stoptli_p)
|
||||
(uint32) (startpoint >> 32), (uint32) startpoint, startxlogfilename);
|
||||
fprintf(fp, "STOP WAL LOCATION: %X/%X (file %s)\n",
|
||||
(uint32) (stoppoint >> 32), (uint32) stoppoint, stopxlogfilename);
|
||||
|
||||
/*
|
||||
* Transfer remaining lines including label and start timeline to
|
||||
* history file.
|
||||
@ -11259,7 +11259,8 @@ read_backup_label(XLogRecPtr *checkPointLoc, bool *backupEndRequired,
|
||||
bool *backupFromStandby)
|
||||
{
|
||||
char startxlogfilename[MAXFNAMELEN];
|
||||
TimeLineID tli_from_walseg, tli_from_file;
|
||||
TimeLineID tli_from_walseg,
|
||||
tli_from_file;
|
||||
FILE *lfp;
|
||||
char ch;
|
||||
char backuptype[20];
|
||||
@ -11322,13 +11323,13 @@ read_backup_label(XLogRecPtr *checkPointLoc, bool *backupEndRequired,
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse START TIME and LABEL. Those are not mandatory fields for
|
||||
* recovery but checking for their presence is useful for debugging
|
||||
* and the next sanity checks. Cope also with the fact that the
|
||||
* result buffers have a pre-allocated size, hence if the backup_label
|
||||
* file has been generated with strings longer than the maximum assumed
|
||||
* here an incorrect parsing happens. That's fine as only minor
|
||||
* consistency checks are done afterwards.
|
||||
* Parse START TIME and LABEL. Those are not mandatory fields for recovery
|
||||
* but checking for their presence is useful for debugging and the next
|
||||
* sanity checks. Cope also with the fact that the result buffers have a
|
||||
* pre-allocated size, hence if the backup_label file has been generated
|
||||
* with strings longer than the maximum assumed here an incorrect parsing
|
||||
* happens. That's fine as only minor consistency checks are done
|
||||
* afterwards.
|
||||
*/
|
||||
if (fscanf(lfp, "START TIME: %127[^\n]\n", backuptime) == 1)
|
||||
ereport(DEBUG1,
|
||||
@ -11341,8 +11342,8 @@ read_backup_label(XLogRecPtr *checkPointLoc, bool *backupEndRequired,
|
||||
backuplabel, BACKUP_LABEL_FILE)));
|
||||
|
||||
/*
|
||||
* START TIMELINE is new as of 11. Its parsing is not mandatory, still
|
||||
* use it as a sanity check if present.
|
||||
* START TIMELINE is new as of 11. Its parsing is not mandatory, still use
|
||||
* it as a sanity check if present.
|
||||
*/
|
||||
if (fscanf(lfp, "START TIMELINE: %u\n", &tli_from_file) == 1)
|
||||
{
|
||||
|
@ -446,6 +446,7 @@ ExecuteGrantStmt(GrantStmt *stmt)
|
||||
switch (stmt->objtype)
|
||||
{
|
||||
case OBJECT_TABLE:
|
||||
|
||||
/*
|
||||
* Because this might be a sequence, we test both relation and
|
||||
* sequence bits, and later do a more limited test when we know
|
||||
@ -3583,10 +3584,12 @@ aclcheck_error(AclResult aclerr, ObjectType objtype,
|
||||
case OBJECT_TSDICTIONARY:
|
||||
msg = gettext_noop("must be owner of text search dictionary %s");
|
||||
break;
|
||||
|
||||
/*
|
||||
* Special cases: For these, the error message talks about
|
||||
* "relation", because that's where the ownership is
|
||||
* attached. See also check_object_ownership().
|
||||
* Special cases: For these, the error message talks
|
||||
* about "relation", because that's where the
|
||||
* ownership is attached. See also
|
||||
* check_object_ownership().
|
||||
*/
|
||||
case OBJECT_COLUMN:
|
||||
case OBJECT_POLICY:
|
||||
|
@ -631,9 +631,9 @@ findDependentObjects(const ObjectAddress *object,
|
||||
* transform this deletion request into a delete of this
|
||||
* owning object.
|
||||
*
|
||||
* For INTERNAL_AUTO dependencies, we don't enforce this;
|
||||
* in other words, we don't follow the links back to the
|
||||
* owning object.
|
||||
* For INTERNAL_AUTO dependencies, we don't enforce this; in
|
||||
* other words, we don't follow the links back to the owning
|
||||
* object.
|
||||
*/
|
||||
if (foundDep->deptype == DEPENDENCY_INTERNAL_AUTO)
|
||||
break;
|
||||
|
@ -1340,8 +1340,8 @@ index_constraint_create(Relation heapRelation,
|
||||
recordDependencyOn(&myself, &referenced, DEPENDENCY_INTERNAL);
|
||||
|
||||
/*
|
||||
* Also, if this is a constraint on a partition, mark it as depending
|
||||
* on the constraint in the parent.
|
||||
* Also, if this is a constraint on a partition, mark it as depending on
|
||||
* the constraint in the parent.
|
||||
*/
|
||||
if (OidIsValid(parentConstraintId))
|
||||
{
|
||||
@ -2105,11 +2105,11 @@ index_update_stats(Relation rel,
|
||||
* It is safe to use a non-transactional update even though our
|
||||
* transaction could still fail before committing. Setting relhasindex
|
||||
* true is safe even if there are no indexes (VACUUM will eventually fix
|
||||
* it). And of course the new relpages and
|
||||
* reltuples counts are correct regardless. However, we don't want to
|
||||
* change relpages (or relallvisible) if the caller isn't providing an
|
||||
* updated reltuples count, because that would bollix the
|
||||
* reltuples/relpages ratio which is what's really important.
|
||||
* it). And of course the new relpages and reltuples counts are correct
|
||||
* regardless. However, we don't want to change relpages (or
|
||||
* relallvisible) if the caller isn't providing an updated reltuples
|
||||
* count, because that would bollix the reltuples/relpages ratio which is
|
||||
* what's really important.
|
||||
*/
|
||||
|
||||
pg_class = heap_open(RelationRelationId, RowExclusiveLock);
|
||||
|
@ -2062,8 +2062,8 @@ pg_get_object_address(PG_FUNCTION_ARGS)
|
||||
}
|
||||
|
||||
/*
|
||||
* get_object_address is pretty sensitive to the length of its input lists;
|
||||
* check that they're what it wants.
|
||||
* get_object_address is pretty sensitive to the length of its input
|
||||
* lists; check that they're what it wants.
|
||||
*/
|
||||
switch (type)
|
||||
{
|
||||
@ -5130,7 +5130,11 @@ get_relkind_objtype(char relkind)
|
||||
return OBJECT_MATVIEW;
|
||||
case RELKIND_FOREIGN_TABLE:
|
||||
return OBJECT_FOREIGN_TABLE;
|
||||
/* other relkinds are not supported here because they don't map to OBJECT_* values */
|
||||
|
||||
/*
|
||||
* other relkinds are not supported here because they don't map to
|
||||
* OBJECT_* values
|
||||
*/
|
||||
default:
|
||||
elog(ERROR, "unexpected relkind: %d", relkind);
|
||||
return 0;
|
||||
|
@ -606,8 +606,8 @@ CloneForeignKeyConstraints(Oid parentId, Oid relationId, List **cloned)
|
||||
if (cloned)
|
||||
{
|
||||
/*
|
||||
* Feed back caller about the constraints we created, so that they can
|
||||
* set up constraint verification.
|
||||
* Feed back caller about the constraints we created, so that they
|
||||
* can set up constraint verification.
|
||||
*/
|
||||
newc = palloc(sizeof(ClonedConstraint));
|
||||
newc->relid = relationId;
|
||||
|
@ -1539,8 +1539,8 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
|
||||
frozenXid, cutoffMulti, mapped_tables);
|
||||
|
||||
/*
|
||||
* If it's a system catalog, queue a sinval message to flush all
|
||||
* catcaches on the catalog when we reach CommandCounterIncrement.
|
||||
* If it's a system catalog, queue a sinval message to flush all catcaches
|
||||
* on the catalog when we reach CommandCounterIncrement.
|
||||
*/
|
||||
if (is_system_catalog)
|
||||
CacheInvalidateCatalog(OIDOldHeap);
|
||||
|
@ -381,11 +381,11 @@ DefineIndex(Oid relationId,
|
||||
|
||||
/*
|
||||
* Calculate the new list of index columns including both key columns and
|
||||
* INCLUDE columns. Later we can determine which of these are key columns,
|
||||
* and which are just part of the INCLUDE list by checking the list
|
||||
* position. A list item in a position less than ii_NumIndexKeyAttrs is
|
||||
* part of the key columns, and anything equal to and over is part of the
|
||||
* INCLUDE columns.
|
||||
* INCLUDE columns. Later we can determine which of these are key
|
||||
* columns, and which are just part of the INCLUDE list by checking the
|
||||
* list position. A list item in a position less than ii_NumIndexKeyAttrs
|
||||
* is part of the key columns, and anything equal to and over is part of
|
||||
* the INCLUDE columns.
|
||||
*/
|
||||
allIndexParams = list_concat(list_copy(stmt->indexParams),
|
||||
list_copy(stmt->indexIncludingParams));
|
||||
@ -431,6 +431,7 @@ DefineIndex(Oid relationId,
|
||||
/* OK */
|
||||
break;
|
||||
case RELKIND_FOREIGN_TABLE:
|
||||
|
||||
/*
|
||||
* Custom error message for FOREIGN TABLE since the term is close
|
||||
* to a regular table and can confuse the user.
|
||||
@ -691,8 +692,8 @@ DefineIndex(Oid relationId,
|
||||
* partition-local index can enforce global uniqueness iff the PK
|
||||
* value completely determines the partition that a row is in.
|
||||
*
|
||||
* Thus, verify that all the columns in the partition key appear
|
||||
* in the unique key definition.
|
||||
* Thus, verify that all the columns in the partition key appear in
|
||||
* the unique key definition.
|
||||
*/
|
||||
for (i = 0; i < key->partnatts; i++)
|
||||
{
|
||||
@ -820,8 +821,8 @@ DefineIndex(Oid relationId,
|
||||
/*
|
||||
* Make the catalog entries for the index, including constraints. This
|
||||
* step also actually builds the index, except if caller requested not to
|
||||
* or in concurrent mode, in which case it'll be done later, or
|
||||
* doing a partitioned index (because those don't have storage).
|
||||
* or in concurrent mode, in which case it'll be done later, or doing a
|
||||
* partitioned index (because those don't have storage).
|
||||
*/
|
||||
flags = constr_flags = 0;
|
||||
if (stmt->isconstraint)
|
||||
@ -871,8 +872,8 @@ DefineIndex(Oid relationId,
|
||||
if (partitioned)
|
||||
{
|
||||
/*
|
||||
* Unless caller specified to skip this step (via ONLY), process
|
||||
* each partition to make sure they all contain a corresponding index.
|
||||
* Unless caller specified to skip this step (via ONLY), process each
|
||||
* partition to make sure they all contain a corresponding index.
|
||||
*
|
||||
* If we're called internally (no stmt->relation), recurse always.
|
||||
*/
|
||||
@ -1014,9 +1015,8 @@ DefineIndex(Oid relationId,
|
||||
|
||||
/*
|
||||
* The pg_index row we inserted for this index was marked
|
||||
* indisvalid=true. But if we attached an existing index that
|
||||
* is invalid, this is incorrect, so update our row to
|
||||
* invalid too.
|
||||
* indisvalid=true. But if we attached an existing index that is
|
||||
* invalid, this is incorrect, so update our row to invalid too.
|
||||
*/
|
||||
if (invalidate_parent)
|
||||
{
|
||||
@ -1505,7 +1505,8 @@ ComputeIndexAttrs(IndexInfo *indexInfo,
|
||||
typeOidP[attn] = atttype;
|
||||
|
||||
/*
|
||||
* Included columns have no collation, no opclass and no ordering options.
|
||||
* Included columns have no collation, no opclass and no ordering
|
||||
* options.
|
||||
*/
|
||||
if (attn >= nkeycols)
|
||||
{
|
||||
@ -2496,8 +2497,8 @@ IndexSetParentIndex(Relation partitionIdx, Oid parentOid)
|
||||
if (parentOid == InvalidOid)
|
||||
{
|
||||
/*
|
||||
* No pg_inherits row, and no parent wanted: nothing to do in
|
||||
* this case.
|
||||
* No pg_inherits row, and no parent wanted: nothing to do in this
|
||||
* case.
|
||||
*/
|
||||
fix_dependencies = false;
|
||||
}
|
||||
|
@ -450,9 +450,9 @@ PersistHoldablePortal(Portal portal)
|
||||
PopActiveSnapshot();
|
||||
|
||||
/*
|
||||
* We can now release any subsidiary memory of the portal's context;
|
||||
* we'll never use it again. The executor already dropped its context,
|
||||
* but this will clean up anything that glommed onto the portal's context via
|
||||
* We can now release any subsidiary memory of the portal's context; we'll
|
||||
* never use it again. The executor already dropped its context, but this
|
||||
* will clean up anything that glommed onto the portal's context via
|
||||
* PortalContext.
|
||||
*/
|
||||
MemoryContextDeleteChildren(portal->portalContext);
|
||||
|
@ -133,7 +133,8 @@ CreateStatistics(CreateStatsStmt *stmt)
|
||||
* If the node has a name, split it up and determine creation namespace.
|
||||
* If not (a possibility not considered by the grammar, but one which can
|
||||
* occur via the "CREATE TABLE ... (LIKE)" command), then we put the
|
||||
* object in the same namespace as the relation, and cons up a name for it.
|
||||
* object in the same namespace as the relation, and cons up a name for
|
||||
* it.
|
||||
*/
|
||||
if (stmt->defnames)
|
||||
namespaceId = QualifiedNameGetCreationNamespace(stmt->defnames,
|
||||
|
@ -1634,7 +1634,8 @@ ExecuteTruncateGuts(List *explicit_rels, List *relids, List *relids_logged,
|
||||
}
|
||||
|
||||
/*
|
||||
* Write a WAL record to allow this set of actions to be logically decoded.
|
||||
* Write a WAL record to allow this set of actions to be logically
|
||||
* decoded.
|
||||
*
|
||||
* Assemble an array of relids so we can write a single WAL record for the
|
||||
* whole action.
|
||||
@ -1648,7 +1649,7 @@ ExecuteTruncateGuts(List *explicit_rels, List *relids, List *relids_logged,
|
||||
Assert(XLogLogicalInfoActive());
|
||||
|
||||
logrelids = palloc(list_length(relids_logged) * sizeof(Oid));
|
||||
foreach (cell, relids_logged)
|
||||
foreach(cell, relids_logged)
|
||||
logrelids[i++] = lfirst_oid(cell);
|
||||
|
||||
xlrec.dbId = MyDatabaseId;
|
||||
@ -5560,8 +5561,8 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
|
||||
CommandCounterIncrement();
|
||||
|
||||
/*
|
||||
* Did the request for a missing value work? If not we'll have to do
|
||||
* a rewrite
|
||||
* Did the request for a missing value work? If not we'll have to do a
|
||||
* rewrite
|
||||
*/
|
||||
if (!rawEnt->missingMode)
|
||||
tab->rewrite |= AT_REWRITE_DEFAULT_VAL;
|
||||
@ -7664,9 +7665,9 @@ ATAddForeignKeyConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel,
|
||||
ObjectAddressSet(address, ConstraintRelationId, constrOid);
|
||||
|
||||
/*
|
||||
* Create the triggers that will enforce the constraint. We only want
|
||||
* the action triggers to appear for the parent partitioned relation,
|
||||
* even though the constraints also exist below.
|
||||
* Create the triggers that will enforce the constraint. We only want the
|
||||
* action triggers to appear for the parent partitioned relation, even
|
||||
* though the constraints also exist below.
|
||||
*/
|
||||
createForeignKeyTriggers(rel, RelationGetRelid(pkrel), fkconstraint,
|
||||
constrOid, indexOid, !recursing);
|
||||
@ -8793,8 +8794,8 @@ createForeignKeyTriggers(Relation rel, Oid refRelOid, Constraint *fkconstraint,
|
||||
indexOid);
|
||||
|
||||
/*
|
||||
* For the referencing side, create the check triggers. We only need these
|
||||
* on the partitions.
|
||||
* For the referencing side, create the check triggers. We only need
|
||||
* these on the partitions.
|
||||
*/
|
||||
if (rel->rd_rel->relkind != RELKIND_PARTITIONED_TABLE)
|
||||
createForeignKeyCheckTriggers(RelationGetRelid(rel), refRelOid,
|
||||
@ -13974,8 +13975,9 @@ QueuePartitionConstraintValidation(List **wqueue, Relation scanrel,
|
||||
}
|
||||
|
||||
/*
|
||||
* Constraints proved insufficient. For plain relations, queue a validation
|
||||
* item now; for partitioned tables, recurse to process each partition.
|
||||
* Constraints proved insufficient. For plain relations, queue a
|
||||
* validation item now; for partitioned tables, recurse to process each
|
||||
* partition.
|
||||
*/
|
||||
if (scanrel->rd_rel->relkind == RELKIND_RELATION)
|
||||
{
|
||||
@ -14300,9 +14302,9 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd)
|
||||
/*
|
||||
* If we're attaching a partition other than the default partition and a
|
||||
* default one exists, then that partition's partition constraint changes,
|
||||
* so add an entry to the work queue to validate it, too. (We must not
|
||||
* do this when the partition being attached is the default one; we
|
||||
* already did it above!)
|
||||
* so add an entry to the work queue to validate it, too. (We must not do
|
||||
* this when the partition being attached is the default one; we already
|
||||
* did it above!)
|
||||
*/
|
||||
if (OidIsValid(defaultPartOid))
|
||||
{
|
||||
@ -14836,7 +14838,8 @@ ATExecAttachPartitionIdx(List **wqueue, Relation parentIdx, RangeVar *name)
|
||||
cldConstrId = InvalidOid;
|
||||
|
||||
/*
|
||||
* If this partition already has an index attached, refuse the operation.
|
||||
* If this partition already has an index attached, refuse the
|
||||
* operation.
|
||||
*/
|
||||
refuseDupeIndexAttach(parentIdx, partIdx, partTbl);
|
||||
|
||||
@ -14890,8 +14893,8 @@ ATExecAttachPartitionIdx(List **wqueue, Relation parentIdx, RangeVar *name)
|
||||
errdetail("The index definitions do not match.")));
|
||||
|
||||
/*
|
||||
* If there is a constraint in the parent, make sure there is one
|
||||
* in the child too.
|
||||
* If there is a constraint in the parent, make sure there is one in
|
||||
* the child too.
|
||||
*/
|
||||
constraintOid = get_relation_idx_constraint_oid(RelationGetRelid(parentTbl),
|
||||
RelationGetRelid(parentIdx));
|
||||
|
@ -5741,8 +5741,9 @@ AfterTriggerSaveEvent(EState *estate, ResultRelInfo *relinfo,
|
||||
* oldtup should be non-NULL, whereas for UPDATE events normally both
|
||||
* oldtup and newtup are non-NULL. But for UPDATE events fired for
|
||||
* capturing transition tuples during UPDATE partition-key row
|
||||
* movement, oldtup is NULL when the event is for a row being inserted,
|
||||
* whereas newtup is NULL when the event is for a row being deleted.
|
||||
* movement, oldtup is NULL when the event is for a row being
|
||||
* inserted, whereas newtup is NULL when the event is for a row being
|
||||
* deleted.
|
||||
*/
|
||||
Assert(!(event == TRIGGER_EVENT_DELETE && delete_old_table &&
|
||||
oldtup == NULL));
|
||||
@ -5791,9 +5792,9 @@ AfterTriggerSaveEvent(EState *estate, ResultRelInfo *relinfo,
|
||||
/*
|
||||
* If transition tables are the only reason we're here, return. As
|
||||
* mentioned above, we can also be here during update tuple routing in
|
||||
* presence of transition tables, in which case this function is called
|
||||
* separately for oldtup and newtup, so we expect exactly one of them
|
||||
* to be NULL.
|
||||
* presence of transition tables, in which case this function is
|
||||
* called separately for oldtup and newtup, so we expect exactly one
|
||||
* of them to be NULL.
|
||||
*/
|
||||
if (trigdesc == NULL ||
|
||||
(event == TRIGGER_EVENT_DELETE && !trigdesc->trig_delete_after_row) ||
|
||||
|
@ -1417,6 +1417,7 @@ ExecGetTriggerResultRel(EState *estate, Oid relid)
|
||||
rInfo++;
|
||||
nr--;
|
||||
}
|
||||
|
||||
/*
|
||||
* Third, search through the result relations that were created during
|
||||
* tuple routing, if any.
|
||||
|
@ -407,10 +407,9 @@ ExecSetExecProcNode(PlanState *node, ExecProcNodeMtd function)
|
||||
{
|
||||
/*
|
||||
* Add a wrapper around the ExecProcNode callback that checks stack depth
|
||||
* during the first execution and maybe adds an instrumentation
|
||||
* wrapper. When the callback is changed after execution has already begun
|
||||
* that means we'll superfluously execute ExecProcNodeFirst, but that seems
|
||||
* ok.
|
||||
* during the first execution and maybe adds an instrumentation wrapper.
|
||||
* When the callback is changed after execution has already begun that
|
||||
* means we'll superfluously execute ExecProcNodeFirst, but that seems ok.
|
||||
*/
|
||||
node->ExecProcNodeReal = function;
|
||||
node->ExecProcNode = ExecProcNodeFirst;
|
||||
|
@ -596,7 +596,8 @@ ExecInitHashJoin(HashJoin *node, EState *estate, int eflags)
|
||||
List *lclauses;
|
||||
List *rclauses;
|
||||
List *hoperators;
|
||||
TupleDesc outerDesc, innerDesc;
|
||||
TupleDesc outerDesc,
|
||||
innerDesc;
|
||||
ListCell *l;
|
||||
|
||||
/* check for unsupported flags */
|
||||
|
@ -1436,7 +1436,8 @@ MergeJoinState *
|
||||
ExecInitMergeJoin(MergeJoin *node, EState *estate, int eflags)
|
||||
{
|
||||
MergeJoinState *mergestate;
|
||||
TupleDesc outerDesc, innerDesc;
|
||||
TupleDesc outerDesc,
|
||||
innerDesc;
|
||||
|
||||
/* check for unsupported flags */
|
||||
Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
|
||||
|
@ -1088,7 +1088,7 @@ lreplace:;
|
||||
*/
|
||||
ExecDelete(mtstate, tupleid, oldtuple, planSlot, epqstate,
|
||||
estate, &tuple_deleted, false,
|
||||
false /* canSetTag */, true /* changingPart */);
|
||||
false /* canSetTag */ , true /* changingPart */ );
|
||||
|
||||
/*
|
||||
* For some reason if DELETE didn't happen (e.g. trigger prevented
|
||||
@ -1678,8 +1678,8 @@ ExecPrepareTupleRouting(ModifyTableState *mtstate,
|
||||
HeapTuple tuple;
|
||||
|
||||
/*
|
||||
* Determine the target partition. If ExecFindPartition does not find
|
||||
* a partition after all, it doesn't return here; otherwise, the returned
|
||||
* Determine the target partition. If ExecFindPartition does not find a
|
||||
* partition after all, it doesn't return here; otherwise, the returned
|
||||
* value is to be used as an index into the arrays for the ResultRelInfo
|
||||
* and TupleConversionMap for the partition.
|
||||
*/
|
||||
@ -2140,7 +2140,7 @@ ExecModifyTable(PlanState *pstate)
|
||||
slot = ExecDelete(node, tupleid, oldtuple, planSlot,
|
||||
&node->mt_epqstate, estate,
|
||||
NULL, true, node->canSetTag,
|
||||
false /* changingPart */);
|
||||
false /* changingPart */ );
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "unknown operation");
|
||||
|
@ -153,8 +153,8 @@ ExecInitSampleScan(SampleScan *node, EState *estate, int eflags)
|
||||
RelationGetDescr(scanstate->ss.ss_currentRelation));
|
||||
|
||||
/*
|
||||
* Initialize result slot, type and projection.
|
||||
* tuple table and result tuple initialization
|
||||
* Initialize result slot, type and projection. tuple table and result
|
||||
* tuple initialization
|
||||
*/
|
||||
ExecInitResultTupleSlotTL(estate, &scanstate->ss.ps);
|
||||
ExecAssignScanProjectionInfo(&scanstate->ss);
|
||||
|
@ -214,8 +214,8 @@ ExecInitSort(Sort *node, EState *estate, int eflags)
|
||||
ExecCreateScanSlotFromOuterPlan(estate, &sortstate->ss);
|
||||
|
||||
/*
|
||||
* Initialize return slot and type. No need to initialize projection info because
|
||||
* this node doesn't do projections.
|
||||
* Initialize return slot and type. No need to initialize projection info
|
||||
* because this node doesn't do projections.
|
||||
*/
|
||||
ExecInitResultTupleSlotTL(estate, &sortstate->ss.ps);
|
||||
sortstate->ss.ps.ps_ProjInfo = NULL;
|
||||
|
@ -131,8 +131,8 @@ ValuesNext(ValuesScanState *node)
|
||||
node->ss.ps.subPlan = NIL;
|
||||
|
||||
/*
|
||||
* As the expressions are only ever used once, disable JIT for
|
||||
* them. This is worthwhile because it's common to insert significant
|
||||
* As the expressions are only ever used once, disable JIT for them.
|
||||
* This is worthwhile because it's common to insert significant
|
||||
* amounts of data via VALUES().
|
||||
*/
|
||||
saved_jit_flags = econtext->ecxt_estate->es_jit_flags;
|
||||
|
@ -2019,8 +2019,8 @@ llvm_compile_expr(ExprState *state)
|
||||
isnull;
|
||||
|
||||
/*
|
||||
* At this point aggref->wfuncno is not yet set (it's
|
||||
* set up in ExecInitWindowAgg() after initializing the
|
||||
* At this point aggref->wfuncno is not yet set (it's set
|
||||
* up in ExecInitWindowAgg() after initializing the
|
||||
* expression). So load it from memory each time round.
|
||||
*/
|
||||
v_wfuncnop = l_ptr_const(&wfunc->wfuncno,
|
||||
|
@ -262,7 +262,8 @@ static void
|
||||
k_hashes(bloom_filter *filter, uint32 *hashes, unsigned char *elem, size_t len)
|
||||
{
|
||||
uint64 hash;
|
||||
uint32 x, y;
|
||||
uint32 x,
|
||||
y;
|
||||
uint64 m;
|
||||
int i;
|
||||
|
||||
|
@ -125,6 +125,7 @@ be_tls_init(bool isServerStart)
|
||||
if (ssl_passphrase_command[0] && ssl_passphrase_command_supports_reload)
|
||||
SSL_CTX_set_default_passwd_cb(context, ssl_external_passwd_cb);
|
||||
else
|
||||
|
||||
/*
|
||||
* If reloading and no external command is configured, override
|
||||
* OpenSSL's default handling of passphrase-protected files,
|
||||
@ -1139,8 +1140,8 @@ be_tls_get_certificate_hash(Port *port, size_t *len)
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* Get the signature algorithm of the certificate to determine the
|
||||
* hash algorithm to use for the result.
|
||||
* Get the signature algorithm of the certificate to determine the hash
|
||||
* algorithm to use for the result.
|
||||
*/
|
||||
if (!OBJ_find_sigid_algs(X509_get_signature_nid(server_cert),
|
||||
&algo_nid, NULL))
|
||||
|
@ -1168,6 +1168,7 @@ bms_prev_member(const Bitmapset *a, int prevbit)
|
||||
{
|
||||
int result;
|
||||
int shift = BITS_PER_BITMAPWORD - 8;
|
||||
|
||||
result = wordnum * BITS_PER_BITMAPWORD;
|
||||
|
||||
while ((w >> shift) == 0)
|
||||
|
@ -216,9 +216,9 @@ nodeTokenType(char *token, int length)
|
||||
{
|
||||
/*
|
||||
* Yes. Figure out whether it is integral or float; this requires
|
||||
* both a syntax check and a range check. strtoint() can do both for us.
|
||||
* We know the token will end at a character that strtoint will stop at,
|
||||
* so we do not need to modify the string.
|
||||
* both a syntax check and a range check. strtoint() can do both for
|
||||
* us. We know the token will end at a character that strtoint will
|
||||
* stop at, so we do not need to modify the string.
|
||||
*/
|
||||
char *endptr;
|
||||
|
||||
|
@ -963,10 +963,10 @@ set_append_rel_size(PlannerInfo *root, RelOptInfo *rel,
|
||||
/*
|
||||
* We need attr_needed data for building targetlist of a join
|
||||
* relation representing join between matching partitions for
|
||||
* partitionwise join. A given attribute of a child will be
|
||||
* needed in the same highest joinrel where the corresponding
|
||||
* attribute of parent is needed. Hence it suffices to use the
|
||||
* same Relids set for parent and child.
|
||||
* partitionwise join. A given attribute of a child will be needed
|
||||
* in the same highest joinrel where the corresponding attribute
|
||||
* of parent is needed. Hence it suffices to use the same Relids
|
||||
* set for parent and child.
|
||||
*/
|
||||
for (attno = rel->min_attr; attno <= rel->max_attr; attno++)
|
||||
{
|
||||
@ -2742,11 +2742,10 @@ standard_join_search(PlannerInfo *root, int levels_needed, List *initial_rels)
|
||||
join_search_one_level(root, lev);
|
||||
|
||||
/*
|
||||
* Run generate_partitionwise_join_paths() and
|
||||
* generate_gather_paths() for each just-processed joinrel. We could
|
||||
* not do this earlier because both regular and partial paths can get
|
||||
* added to a particular joinrel at multiple times within
|
||||
* join_search_one_level.
|
||||
* Run generate_partitionwise_join_paths() and generate_gather_paths()
|
||||
* for each just-processed joinrel. We could not do this earlier
|
||||
* because both regular and partial paths can get added to a
|
||||
* particular joinrel at multiple times within join_search_one_level.
|
||||
*
|
||||
* After that, we're done creating paths for the joinrel, so run
|
||||
* set_cheapest().
|
||||
|
@ -2696,6 +2696,7 @@ match_clause_to_ordering_op(IndexOptInfo *index,
|
||||
|
||||
opfamily = index->opfamily[indexcol];
|
||||
idxcollation = index->indexcollations[indexcol];
|
||||
|
||||
/*
|
||||
* Clause must be a binary opclause.
|
||||
*/
|
||||
|
@ -1338,8 +1338,8 @@ try_partitionwise_join(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2,
|
||||
joinrel->part_scheme == rel2->part_scheme);
|
||||
|
||||
/*
|
||||
* Since we allow partitionwise join only when the partition bounds of
|
||||
* the joining relations exactly match, the partition bounds of the join
|
||||
* Since we allow partitionwise join only when the partition bounds of the
|
||||
* joining relations exactly match, the partition bounds of the join
|
||||
* should match those of the joining relations.
|
||||
*/
|
||||
Assert(partition_bounds_equal(joinrel->part_scheme->partnatts,
|
||||
|
@ -6797,10 +6797,10 @@ apply_scanjoin_target_to_paths(PlannerInfo *root,
|
||||
{
|
||||
/*
|
||||
* Since we can't generate the final scan/join target, this is our
|
||||
* last opportunity to use any partial paths that exist. We don't
|
||||
* do this if the case where the target is parallel-safe, since we
|
||||
* will be able to generate superior paths by doing it after the
|
||||
* final scan/join target has been applied.
|
||||
* last opportunity to use any partial paths that exist. We don't do
|
||||
* this if the case where the target is parallel-safe, since we will
|
||||
* be able to generate superior paths by doing it after the final
|
||||
* scan/join target has been applied.
|
||||
*
|
||||
* Note that this may invalidate rel->cheapest_total_path, so we must
|
||||
* not rely on it after this point without first calling set_cheapest.
|
||||
|
@ -1688,9 +1688,9 @@ expand_partitioned_rtentry(PlannerInfo *root, RangeTblEntry *parentrte,
|
||||
/*
|
||||
* Note down whether any partition key cols are being updated. Though it's
|
||||
* the root partitioned table's updatedCols we are interested in, we
|
||||
* instead use parentrte to get the updatedCols. This is convenient because
|
||||
* parentrte already has the root partrel's updatedCols translated to match
|
||||
* the attribute ordering of parentrel.
|
||||
* instead use parentrte to get the updatedCols. This is convenient
|
||||
* because parentrte already has the root partrel's updatedCols translated
|
||||
* to match the attribute ordering of parentrel.
|
||||
*/
|
||||
if (!root->partColsUpdated)
|
||||
root->partColsUpdated =
|
||||
|
@ -1421,6 +1421,7 @@ relation_excluded_by_constraints(PlannerInfo *root,
|
||||
switch (constraint_exclusion)
|
||||
{
|
||||
case CONSTRAINT_EXCLUSION_OFF:
|
||||
|
||||
/*
|
||||
* Don't prune if feature turned off -- except if the relation is
|
||||
* a partition. While partprune.c-style partition pruning is not
|
||||
@ -1435,6 +1436,7 @@ relation_excluded_by_constraints(PlannerInfo *root,
|
||||
return false;
|
||||
|
||||
case CONSTRAINT_EXCLUSION_PARTITION:
|
||||
|
||||
/*
|
||||
* When constraint_exclusion is set to 'partition' we only handle
|
||||
* OTHER_MEMBER_RELs, or BASERELs in cases where the result target
|
||||
|
@ -484,10 +484,10 @@ generateSerialExtraStmts(CreateStmtContext *cxt, ColumnDef *column,
|
||||
cxt->blist = lappend(cxt->blist, seqstmt);
|
||||
|
||||
/*
|
||||
* Store the identity sequence name that we decided on. ALTER TABLE
|
||||
* ... ADD COLUMN ... IDENTITY needs this so that it can fill the new
|
||||
* column with values from the sequence, while the association of the
|
||||
* sequence with the table is not set until after the ALTER TABLE.
|
||||
* Store the identity sequence name that we decided on. ALTER TABLE ...
|
||||
* ADD COLUMN ... IDENTITY needs this so that it can fill the new column
|
||||
* with values from the sequence, while the association of the sequence
|
||||
* with the table is not set until after the ALTER TABLE.
|
||||
*/
|
||||
column->identitySequence = seqstmt->sequence;
|
||||
|
||||
|
@ -1530,8 +1530,8 @@ match_clause_to_partition_key(RelOptInfo *rel,
|
||||
{
|
||||
/*
|
||||
* For range and list partitioning, we need the ordering
|
||||
* procedure with lefttype being the partition key's type, and
|
||||
* righttype the clause's operator's right type.
|
||||
* procedure with lefttype being the partition key's type,
|
||||
* and righttype the clause's operator's right type.
|
||||
*/
|
||||
case PARTITION_STRATEGY_LIST:
|
||||
case PARTITION_STRATEGY_RANGE:
|
||||
@ -1542,8 +1542,8 @@ match_clause_to_partition_key(RelOptInfo *rel,
|
||||
break;
|
||||
|
||||
/*
|
||||
* For hash partitioning, we need the hashing procedure for
|
||||
* the clause's type.
|
||||
* For hash partitioning, we need the hashing procedure
|
||||
* for the clause's type.
|
||||
*/
|
||||
case PARTITION_STRATEGY_HASH:
|
||||
cmpfn =
|
||||
|
@ -267,8 +267,8 @@ retry:
|
||||
size);
|
||||
|
||||
/*
|
||||
* Use the original size, not the rounded-up value, when falling back
|
||||
* to non-huge pages.
|
||||
* Use the original size, not the rounded-up value, when
|
||||
* falling back to non-huge pages.
|
||||
*/
|
||||
size = orig_size;
|
||||
flProtect = PAGE_READWRITE;
|
||||
|
@ -243,8 +243,8 @@ perform_base_backup(basebackup_options *opt)
|
||||
/*
|
||||
* Once do_pg_start_backup has been called, ensure that any failure causes
|
||||
* us to abort the backup so we don't "leak" a backup counter. For this
|
||||
* reason, *all* functionality between do_pg_start_backup() and
|
||||
* the end of do_pg_stop_backup() should be inside the error cleanup block!
|
||||
* reason, *all* functionality between do_pg_start_backup() and the end of
|
||||
* do_pg_stop_backup() should be inside the error cleanup block!
|
||||
*/
|
||||
|
||||
PG_ENSURE_ERROR_CLEANUP(base_backup_cleanup, (Datum) 0);
|
||||
@ -1019,11 +1019,11 @@ sendDir(const char *path, int basepathlen, bool sizeonly, List *tablespaces,
|
||||
bool isDbDir = false; /* Does this directory contain relations? */
|
||||
|
||||
/*
|
||||
* Determine if the current path is a database directory that can
|
||||
* contain relations.
|
||||
* Determine if the current path is a database directory that can contain
|
||||
* relations.
|
||||
*
|
||||
* Start by finding the location of the delimiter between the parent
|
||||
* path and the current path.
|
||||
* Start by finding the location of the delimiter between the parent path
|
||||
* and the current path.
|
||||
*/
|
||||
lastDir = last_dir_separator(path);
|
||||
|
||||
@ -1417,10 +1417,10 @@ sendFile(const char *readfilename, const char *tarfilename, struct stat *statbuf
|
||||
while ((cnt = fread(buf, 1, Min(sizeof(buf), statbuf->st_size - len), fp)) > 0)
|
||||
{
|
||||
/*
|
||||
* The checksums are verified at block level, so we iterate over
|
||||
* the buffer in chunks of BLCKSZ, after making sure that
|
||||
* TAR_SEND_SIZE/buf is divisible by BLCKSZ and we read a multiple
|
||||
* of BLCKSZ bytes.
|
||||
* The checksums are verified at block level, so we iterate over the
|
||||
* buffer in chunks of BLCKSZ, after making sure that
|
||||
* TAR_SEND_SIZE/buf is divisible by BLCKSZ and we read a multiple of
|
||||
* BLCKSZ bytes.
|
||||
*/
|
||||
Assert(TAR_SEND_SIZE % BLCKSZ == 0);
|
||||
|
||||
@ -1445,9 +1445,8 @@ sendFile(const char *readfilename, const char *tarfilename, struct stat *statbuf
|
||||
* start of the base backup. Otherwise, they might have been
|
||||
* written only halfway and the checksum would not be valid.
|
||||
* However, replaying WAL would reinstate the correct page in
|
||||
* this case.
|
||||
* We also skip completely new pages, since they don't have
|
||||
* a checksum yet.
|
||||
* this case. We also skip completely new pages, since they
|
||||
* don't have a checksum yet.
|
||||
*/
|
||||
if (!PageIsNew(page) && PageGetLSN(page) < startptr)
|
||||
{
|
||||
|
@ -936,9 +936,9 @@ apply_handle_truncate(StringInfo s)
|
||||
}
|
||||
|
||||
/*
|
||||
* Even if we used CASCADE on the upstream master we explicitly
|
||||
* default to replaying changes without further cascading.
|
||||
* This might be later changeable with a user specified option.
|
||||
* Even if we used CASCADE on the upstream master we explicitly default to
|
||||
* replaying changes without further cascading. This might be later
|
||||
* changeable with a user specified option.
|
||||
*/
|
||||
ExecuteTruncateGuts(rels, relids, relids_logged, DROP_RESTRICT, restart_seqs);
|
||||
|
||||
|
@ -1461,8 +1461,8 @@ pg_stat_get_wal_receiver(PG_FUNCTION_ARGS)
|
||||
{
|
||||
/*
|
||||
* Only superusers and members of pg_read_all_stats can see details.
|
||||
* Other users only get the pid value
|
||||
* to know whether it is a WAL receiver, but no details.
|
||||
* Other users only get the pid value to know whether it is a WAL
|
||||
* receiver, but no details.
|
||||
*/
|
||||
MemSet(&nulls[1], true, sizeof(bool) * (tupdesc->natts - 1));
|
||||
}
|
||||
|
@ -3247,9 +3247,9 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
|
||||
if (!is_member_of_role(GetUserId(), DEFAULT_ROLE_READ_ALL_STATS))
|
||||
{
|
||||
/*
|
||||
* Only superusers and members of pg_read_all_stats can see details.
|
||||
* Other users only get the pid value to know it's a walsender,
|
||||
* but no details.
|
||||
* Only superusers and members of pg_read_all_stats can see
|
||||
* details. Other users only get the pid value to know it's a
|
||||
* walsender, but no details.
|
||||
*/
|
||||
MemSet(&nulls[1], true, PG_STAT_GET_WAL_SENDERS_COLS - 1);
|
||||
}
|
||||
|
@ -213,9 +213,9 @@ MakeNewSharedSegment(BufFile *buffile, int segment)
|
||||
|
||||
/*
|
||||
* It is possible that there are files left over from before a crash
|
||||
* restart with the same name. In order for BufFileOpenShared()
|
||||
* not to get confused about how many segments there are, we'll unlink
|
||||
* the next segment number if it already exists.
|
||||
* restart with the same name. In order for BufFileOpenShared() not to
|
||||
* get confused about how many segments there are, we'll unlink the next
|
||||
* segment number if it already exists.
|
||||
*/
|
||||
SharedSegmentName(name, buffile->name, segment + 1);
|
||||
SharedFileSetDelete(buffile->fileset, name, true);
|
||||
|
@ -1203,9 +1203,10 @@ shm_mq_inc_bytes_read(shm_mq *mq, Size n)
|
||||
|
||||
/*
|
||||
* Separate prior reads of mq_ring from the increment of mq_bytes_read
|
||||
* which follows. This pairs with the full barrier in shm_mq_send_bytes().
|
||||
* We only need a read barrier here because the increment of mq_bytes_read
|
||||
* is actually a read followed by a dependent write.
|
||||
* which follows. This pairs with the full barrier in
|
||||
* shm_mq_send_bytes(). We only need a read barrier here because the
|
||||
* increment of mq_bytes_read is actually a read followed by a dependent
|
||||
* write.
|
||||
*/
|
||||
pg_read_barrier();
|
||||
|
||||
|
@ -187,8 +187,8 @@ indexam_property(FunctionCallInfo fcinfo,
|
||||
}
|
||||
|
||||
/*
|
||||
* At this point, either index_oid == InvalidOid or it's a valid index OID.
|
||||
* Also, after this test and the one below, either attno == 0 for
|
||||
* At this point, either index_oid == InvalidOid or it's a valid index
|
||||
* OID. Also, after this test and the one below, either attno == 0 for
|
||||
* index-wide or AM-wide tests, or it's a valid column number in a valid
|
||||
* index.
|
||||
*/
|
||||
@ -276,6 +276,7 @@ indexam_property(FunctionCallInfo fcinfo,
|
||||
break;
|
||||
|
||||
case AMPROP_ORDERABLE:
|
||||
|
||||
/*
|
||||
* generic assumption is that nonkey columns are not orderable
|
||||
*/
|
||||
@ -293,8 +294,9 @@ indexam_property(FunctionCallInfo fcinfo,
|
||||
* getting there from just the index column type seems like a
|
||||
* lot of work. So instead we expect the AM to handle this in
|
||||
* its amproperty routine. The generic result is to return
|
||||
* false if the AM says it never supports this, or if this is a
|
||||
* nonkey column, and null otherwise (meaning we don't know).
|
||||
* false if the AM says it never supports this, or if this is
|
||||
* a nonkey column, and null otherwise (meaning we don't
|
||||
* know).
|
||||
*/
|
||||
if (!iskey || !routine->amcanorderbyop)
|
||||
{
|
||||
@ -314,8 +316,8 @@ indexam_property(FunctionCallInfo fcinfo,
|
||||
{
|
||||
/*
|
||||
* If possible, the AM should handle this test in its
|
||||
* amproperty function without opening the rel. But this is the
|
||||
* generic fallback if it does not.
|
||||
* amproperty function without opening the rel. But this
|
||||
* is the generic fallback if it does not.
|
||||
*/
|
||||
Relation indexrel = index_open(index_oid, AccessShareLock);
|
||||
|
||||
|
@ -1861,8 +1861,8 @@ JsonbExtractScalar(JsonbContainer *jbc, JsonbValue *res)
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* A root scalar is stored as an array of one element, so we get the
|
||||
* array and then its first (and only) member.
|
||||
* A root scalar is stored as an array of one element, so we get the array
|
||||
* and then its first (and only) member.
|
||||
*/
|
||||
it = JsonbIteratorInit(jbc);
|
||||
|
||||
@ -1871,11 +1871,11 @@ JsonbExtractScalar(JsonbContainer *jbc, JsonbValue *res)
|
||||
Assert(tmp.val.array.nElems == 1 && tmp.val.array.rawScalar);
|
||||
|
||||
tok = JsonbIteratorNext(&it, res, true);
|
||||
Assert (tok == WJB_ELEM);
|
||||
Assert(tok == WJB_ELEM);
|
||||
Assert(IsAJsonbScalar(res));
|
||||
|
||||
tok = JsonbIteratorNext(&it, &tmp, true);
|
||||
Assert (tok == WJB_END_ARRAY);
|
||||
Assert(tok == WJB_END_ARRAY);
|
||||
|
||||
tok = JsonbIteratorNext(&it, &tmp, true);
|
||||
Assert(tok == WJB_DONE);
|
||||
@ -1912,7 +1912,8 @@ jsonb_numeric(PG_FUNCTION_ARGS)
|
||||
errmsg("jsonb value must be numeric")));
|
||||
|
||||
/*
|
||||
* v.val.numeric points into jsonb body, so we need to make a copy to return
|
||||
* v.val.numeric points into jsonb body, so we need to make a copy to
|
||||
* return
|
||||
*/
|
||||
retValue = DatumGetNumericCopy(NumericGetDatum(v.val.numeric));
|
||||
|
||||
|
@ -60,7 +60,8 @@ typedef struct IterateJsonStringValuesState
|
||||
JsonIterateStringValuesAction action; /* an action that will be applied
|
||||
* to each json value */
|
||||
void *action_state; /* any necessary context for iteration */
|
||||
uint32 flags; /* what kind of elements from a json we want to iterate */
|
||||
uint32 flags; /* what kind of elements from a json we want
|
||||
* to iterate */
|
||||
} IterateJsonStringValuesState;
|
||||
|
||||
/* state for transform_json_string_values function */
|
||||
@ -4960,9 +4961,9 @@ parse_jsonb_index_flags(Jsonb *jb)
|
||||
type = JsonbIteratorNext(&it, &v, false);
|
||||
|
||||
/*
|
||||
* We iterate over array (scalar internally is represented as array, so, we
|
||||
* will accept it too) to check all its elements. Flag names are chosen
|
||||
* the same as jsonb_typeof uses.
|
||||
* We iterate over array (scalar internally is represented as array, so,
|
||||
* we will accept it too) to check all its elements. Flag names are
|
||||
* chosen the same as jsonb_typeof uses.
|
||||
*/
|
||||
if (type != WJB_BEGIN_ARRAY)
|
||||
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
@ -5045,7 +5046,7 @@ iterate_jsonb_values(Jsonb *jb, uint32 flags, void *state,
|
||||
}
|
||||
|
||||
/* JsonbValue is a value of object or element of array */
|
||||
switch(v.type)
|
||||
switch (v.type)
|
||||
{
|
||||
case jbvString:
|
||||
if (flags & jtiString)
|
||||
@ -5112,7 +5113,7 @@ iterate_values_scalar(void *state, char *token, JsonTokenType tokentype)
|
||||
{
|
||||
IterateJsonStringValuesState *_state = (IterateJsonStringValuesState *) state;
|
||||
|
||||
switch(tokentype)
|
||||
switch (tokentype)
|
||||
{
|
||||
case JSON_TOKEN_STRING:
|
||||
if (_state->flags & jtiString)
|
||||
@ -5141,6 +5142,7 @@ iterate_values_object_field_start(void *state, char *fname, bool isnull)
|
||||
if (_state->flags & jtiKey)
|
||||
{
|
||||
char *val = pstrdup(fname);
|
||||
|
||||
_state->action(_state->action_state, val, strlen(val));
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ typedef enum
|
||||
* *strval, *lenval and *weight are filled in when return value is PT_VAL
|
||||
*
|
||||
*/
|
||||
typedef ts_tokentype (*ts_tokenizer)(TSQueryParserState state, int8 *operator,
|
||||
typedef ts_tokentype (*ts_tokenizer) (TSQueryParserState state, int8 *operator,
|
||||
int *lenval, char **strval,
|
||||
int16 *weight, bool *prefix);
|
||||
|
||||
@ -245,8 +245,8 @@ parse_or_operator(TSQueryParserState pstate)
|
||||
ptr += 2;
|
||||
|
||||
/*
|
||||
* it shouldn't be a part of any word but somewhere later it should be some
|
||||
* operand
|
||||
* it shouldn't be a part of any word but somewhere later it should be
|
||||
* some operand
|
||||
*/
|
||||
if (*ptr == '\0') /* no operand */
|
||||
return false;
|
||||
@ -255,7 +255,7 @@ parse_or_operator(TSQueryParserState pstate)
|
||||
if (t_iseq(ptr, '-') || t_iseq(ptr, '_') || t_isalpha(ptr) || t_isdigit(ptr))
|
||||
return false;
|
||||
|
||||
for(;;)
|
||||
for (;;)
|
||||
{
|
||||
ptr += pg_mblen(ptr);
|
||||
|
||||
@ -263,8 +263,8 @@ parse_or_operator(TSQueryParserState pstate)
|
||||
return false;
|
||||
|
||||
/*
|
||||
* Suppose, we found an operand, but could be a not correct operand. So
|
||||
* we still treat OR literal as operation with possibly incorrect
|
||||
* Suppose, we found an operand, but could be a not correct operand.
|
||||
* So we still treat OR literal as operation with possibly incorrect
|
||||
* operand and will not search it as lexeme
|
||||
*/
|
||||
if (!t_isspace(ptr))
|
||||
@ -312,7 +312,10 @@ gettoken_query_standard(TSQueryParserState state, int8 *operator,
|
||||
}
|
||||
else if (!t_isspace(state->buf))
|
||||
{
|
||||
/* We rely on the tsvector parser to parse the value for us */
|
||||
/*
|
||||
* We rely on the tsvector parser to parse the value for
|
||||
* us
|
||||
*/
|
||||
reset_tsvector_parser(state->valstate, state->buf);
|
||||
if (gettoken_tsvector(state->valstate, strval, lenval,
|
||||
NULL, NULL, &state->buf))
|
||||
@ -437,7 +440,10 @@ gettoken_query_websearch(TSQueryParserState state, int8 *operator,
|
||||
}
|
||||
else if (!t_isspace(state->buf))
|
||||
{
|
||||
/* We rely on the tsvector parser to parse the value for us */
|
||||
/*
|
||||
* We rely on the tsvector parser to parse the value for
|
||||
* us
|
||||
*/
|
||||
reset_tsvector_parser(state->valstate, state->buf);
|
||||
if (gettoken_tsvector(state->valstate, strval, lenval,
|
||||
NULL, NULL, &state->buf))
|
||||
@ -464,8 +470,8 @@ gettoken_query_websearch(TSQueryParserState state, int8 *operator,
|
||||
if (!state->in_quotes)
|
||||
{
|
||||
/*
|
||||
* put implicit AND after an operand
|
||||
* and handle this quote in WAITOPERAND
|
||||
* put implicit AND after an operand and handle this
|
||||
* quote in WAITOPERAND
|
||||
*/
|
||||
state->state = WAITOPERAND;
|
||||
*operator = OP_AND;
|
||||
|
3
src/backend/utils/cache/relcache.c
vendored
3
src/backend/utils/cache/relcache.c
vendored
@ -4678,7 +4678,8 @@ RelationGetIndexPredicate(Relation relation)
|
||||
expensive, so we don't attempt it by default.
|
||||
* 2. "recheck_on_update" index option explicitly set by user, which overrides 1)
|
||||
*/
|
||||
static bool IsProjectionFunctionalIndex(Relation index, IndexInfo* ii)
|
||||
static bool
|
||||
IsProjectionFunctionalIndex(Relation index, IndexInfo *ii)
|
||||
{
|
||||
bool is_projection = false;
|
||||
|
||||
|
@ -59,6 +59,7 @@ static void fmgr_info_other_lang(Oid functionId, FmgrInfo *finfo, HeapTuple proc
|
||||
static CFuncHashTabEntry *lookup_C_func(HeapTuple procedureTuple);
|
||||
static void record_C_func(HeapTuple procedureTuple,
|
||||
PGFunction user_fn, const Pg_finfo_record *inforec);
|
||||
|
||||
/* extern so it's callable via JIT */
|
||||
extern Datum fmgr_security_definer(PG_FUNCTION_ARGS);
|
||||
|
||||
|
@ -1754,6 +1754,7 @@ static struct config_bool ConfigureNamesBool[] =
|
||||
},
|
||||
&jit_debugging_support,
|
||||
false,
|
||||
|
||||
/*
|
||||
* This is not guaranteed to be available, but given it's a developer
|
||||
* oriented option, it doesn't seem worth adding code checking
|
||||
@ -1792,6 +1793,7 @@ static struct config_bool ConfigureNamesBool[] =
|
||||
},
|
||||
&jit_profiling_support,
|
||||
false,
|
||||
|
||||
/*
|
||||
* This is not guaranteed to be available, but given it's a developer
|
||||
* oriented option, it doesn't seem worth adding code checking
|
||||
|
@ -630,8 +630,8 @@ static void
|
||||
HoldPortal(Portal portal)
|
||||
{
|
||||
/*
|
||||
* Note that PersistHoldablePortal() must release all resources
|
||||
* used by the portal that are local to the creating transaction.
|
||||
* Note that PersistHoldablePortal() must release all resources used by
|
||||
* the portal that are local to the creating transaction.
|
||||
*/
|
||||
PortalCreateHoldStore(portal);
|
||||
PersistHoldablePortal(portal);
|
||||
@ -640,15 +640,15 @@ HoldPortal(Portal portal)
|
||||
PortalReleaseCachedPlan(portal);
|
||||
|
||||
/*
|
||||
* Any resources belonging to the portal will be released in the
|
||||
* upcoming transaction-wide cleanup; the portal will no longer
|
||||
* have its own resources.
|
||||
* Any resources belonging to the portal will be released in the upcoming
|
||||
* transaction-wide cleanup; the portal will no longer have its own
|
||||
* resources.
|
||||
*/
|
||||
portal->resowner = NULL;
|
||||
|
||||
/*
|
||||
* Having successfully exported the holdable cursor, mark it as
|
||||
* not belonging to this transaction.
|
||||
* Having successfully exported the holdable cursor, mark it as not
|
||||
* belonging to this transaction.
|
||||
*/
|
||||
portal->createSubid = InvalidSubTransactionId;
|
||||
portal->activeSubid = InvalidSubTransactionId;
|
||||
@ -1240,8 +1240,8 @@ HoldPinnedPortals(void)
|
||||
{
|
||||
/*
|
||||
* Doing transaction control, especially abort, inside a cursor
|
||||
* loop that is not read-only, for example using UPDATE
|
||||
* ... RETURNING, has weird semantics issues. Also, this
|
||||
* loop that is not read-only, for example using UPDATE ...
|
||||
* RETURNING, has weird semantics issues. Also, this
|
||||
* implementation wouldn't work, because such portals cannot be
|
||||
* held. (The core grammar enforces that only SELECT statements
|
||||
* can drive a cursor, but for example PL/pgSQL does not restrict
|
||||
|
@ -219,9 +219,9 @@ GetConnection(void)
|
||||
|
||||
/*
|
||||
* Set always-secure search path, so malicious users can't get control.
|
||||
* The capacity to run normal SQL queries was added in PostgreSQL
|
||||
* 10, so the search path cannot be changed (by us or attackers) on
|
||||
* earlier versions.
|
||||
* The capacity to run normal SQL queries was added in PostgreSQL 10, so
|
||||
* the search path cannot be changed (by us or attackers) on earlier
|
||||
* versions.
|
||||
*/
|
||||
if (dbname != NULL && PQserverVersion(tmpconn) >= 100000)
|
||||
{
|
||||
|
@ -1846,7 +1846,8 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser
|
||||
static PTOKEN_PRIVILEGES
|
||||
GetPrivilegesToDelete(HANDLE hToken)
|
||||
{
|
||||
int i, j;
|
||||
int i,
|
||||
j;
|
||||
DWORD length;
|
||||
PTOKEN_PRIVILEGES tokenPrivs;
|
||||
LUID luidLockPages;
|
||||
|
@ -350,8 +350,8 @@ flagInhTables(Archive *fout, TableInfo *tblinfo, int numTables,
|
||||
findParentsByOid(&tblinfo[i], inhinfo, numInherits);
|
||||
|
||||
/*
|
||||
* If needed, mark the parents as interesting for getTableAttrs
|
||||
* and getIndexes.
|
||||
* If needed, mark the parents as interesting for getTableAttrs and
|
||||
* getIndexes.
|
||||
*/
|
||||
if (mark_parents)
|
||||
{
|
||||
@ -430,9 +430,9 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
|
||||
|
||||
/*
|
||||
* We want dependencies from parent to partition (so that the
|
||||
* partition index is created first), and another one from
|
||||
* attach object to parent (so that the partition index is
|
||||
* attached once the parent index has been created).
|
||||
* partition index is created first), and another one from attach
|
||||
* object to parent (so that the partition index is attached once
|
||||
* the parent index has been created).
|
||||
*/
|
||||
addObjectDependency(&parentidx->dobj, index->dobj.dumpId);
|
||||
addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId);
|
||||
|
@ -16436,10 +16436,10 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo)
|
||||
char *only;
|
||||
|
||||
/*
|
||||
* Foreign keys on partitioned tables are always declared as inheriting
|
||||
* to partitions; for all other cases, emit them as applying ONLY
|
||||
* directly to the named table, because that's how they work for
|
||||
* regular inherited tables.
|
||||
* Foreign keys on partitioned tables are always declared as
|
||||
* inheriting to partitions; for all other cases, emit them as
|
||||
* applying ONLY directly to the named table, because that's how they
|
||||
* work for regular inherited tables.
|
||||
*/
|
||||
only = tbinfo->relkind == RELKIND_PARTITIONED_TABLE ? "" : "ONLY ";
|
||||
|
||||
|
@ -733,8 +733,8 @@ isRelDataFile(const char *path)
|
||||
/*
|
||||
* The sscanf tests above can match files that have extra characters at
|
||||
* the end. To eliminate such cases, cross-check that GetRelationPath
|
||||
* creates the exact same filename, when passed the RelFileNode information
|
||||
* we extracted from the filename.
|
||||
* creates the exact same filename, when passed the RelFileNode
|
||||
* information we extracted from the filename.
|
||||
*/
|
||||
if (matched)
|
||||
{
|
||||
|
@ -110,6 +110,7 @@ exec_prog(const char *log_file, const char *opt_log_file,
|
||||
pg_log(PG_VERBOSE, "%s\n", cmd);
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
/*
|
||||
* For some reason, Windows issues a file-in-use error if we write data to
|
||||
* the log file from a non-primary thread just before we create a
|
||||
@ -191,6 +192,7 @@ exec_prog(const char *log_file, const char *opt_log_file,
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
/*
|
||||
* We can't do this on Windows because it will keep the "pg_ctl start"
|
||||
* output filename open until the server stops, so we do the \n\n above on
|
||||
|
@ -309,8 +309,8 @@ start_postmaster(ClusterInfo *cluster, bool report_and_exit_on_error)
|
||||
|
||||
/*
|
||||
* If pg_ctl failed, and the connection didn't fail, and
|
||||
* report_and_exit_on_error is enabled, fail now. This
|
||||
* could happen if the server was already running.
|
||||
* report_and_exit_on_error is enabled, fail now. This could happen if
|
||||
* the server was already running.
|
||||
*/
|
||||
if (!pg_ctl_return)
|
||||
{
|
||||
|
@ -820,7 +820,7 @@ generalizedHarmonicNumber(int64 n, double s)
|
||||
|
||||
/* set harmonicn and other parameters to cache cell */
|
||||
static void
|
||||
zipfSetCacheCell(ZipfCell * cell, int64 n, double s)
|
||||
zipfSetCacheCell(ZipfCell *cell, int64 n, double s)
|
||||
{
|
||||
double harmonic2;
|
||||
|
||||
@ -840,7 +840,7 @@ zipfSetCacheCell(ZipfCell * cell, int64 n, double s)
|
||||
* and create new cell if it does not exist
|
||||
*/
|
||||
static ZipfCell *
|
||||
zipfFindOrCreateCacheCell(ZipfCache * cache, int64 n, double s)
|
||||
zipfFindOrCreateCacheCell(ZipfCache *cache, int64 n, double s)
|
||||
{
|
||||
int i,
|
||||
least_recently_used = 0;
|
||||
@ -1261,10 +1261,10 @@ makeVariableValue(Variable *var)
|
||||
{
|
||||
setNullValue(&var->value);
|
||||
}
|
||||
|
||||
/*
|
||||
* accept prefixes such as y, ye, n, no... but not for "o".
|
||||
* 0/1 are recognized later as an int, which is converted
|
||||
* to bool if needed.
|
||||
* accept prefixes such as y, ye, n, no... but not for "o". 0/1 are
|
||||
* recognized later as an int, which is converted to bool if needed.
|
||||
*/
|
||||
else if (pg_strncasecmp(var->svalue, "true", slen) == 0 ||
|
||||
pg_strncasecmp(var->svalue, "yes", slen) == 0 ||
|
||||
@ -1676,7 +1676,8 @@ setDoubleValue(PgBenchValue *pv, double dval)
|
||||
pv->u.dval = dval;
|
||||
}
|
||||
|
||||
static bool isLazyFunc(PgBenchFunction func)
|
||||
static bool
|
||||
isLazyFunc(PgBenchFunction func)
|
||||
{
|
||||
return func == PGBENCH_AND || func == PGBENCH_OR || func == PGBENCH_CASE;
|
||||
}
|
||||
@ -1686,8 +1687,10 @@ static bool
|
||||
evalLazyFunc(TState *thread, CState *st,
|
||||
PgBenchFunction func, PgBenchExprLink *args, PgBenchValue *retval)
|
||||
{
|
||||
PgBenchValue a1, a2;
|
||||
bool ba1, ba2;
|
||||
PgBenchValue a1,
|
||||
a2;
|
||||
bool ba1,
|
||||
ba2;
|
||||
|
||||
Assert(isLazyFunc(func) && args != NULL && args->next != NULL);
|
||||
|
||||
@ -1984,7 +1987,8 @@ evalStandardFunc(TState *thread, CState *st,
|
||||
case PGBENCH_LSHIFT:
|
||||
case PGBENCH_RSHIFT:
|
||||
{
|
||||
int64 li, ri;
|
||||
int64 li,
|
||||
ri;
|
||||
|
||||
if (!coerceToInt(&vargs[0], &li) || !coerceToInt(&vargs[1], &ri))
|
||||
return false;
|
||||
@ -2009,6 +2013,7 @@ evalStandardFunc(TState *thread, CState *st,
|
||||
case PGBENCH_NOT:
|
||||
{
|
||||
bool b;
|
||||
|
||||
if (!coerceToBool(&vargs[0], &b))
|
||||
return false;
|
||||
|
||||
@ -2275,7 +2280,11 @@ evalStandardFunc(TState *thread, CState *st,
|
||||
case PGBENCH_IS:
|
||||
{
|
||||
Assert(nargs == 2);
|
||||
/* note: this simple implementation is more permissive than SQL */
|
||||
|
||||
/*
|
||||
* note: this simple implementation is more permissive than
|
||||
* SQL
|
||||
*/
|
||||
setBoolValue(retval,
|
||||
vargs[0].type == vargs[1].type &&
|
||||
vargs[0].u.bval == vargs[1].u.bval);
|
||||
@ -2935,7 +2944,10 @@ doCustom(TState *thread, CState *st, StatsData *agg)
|
||||
if (command->meta == META_ELIF &&
|
||||
conditional_stack_peek(st->cstack) == IFSTATE_TRUE)
|
||||
{
|
||||
/* elif after executed block, skip eval and wait for endif */
|
||||
/*
|
||||
* elif after executed block, skip eval and wait
|
||||
* for endif
|
||||
*/
|
||||
conditional_stack_poke(st->cstack, IFSTATE_IGNORED);
|
||||
goto move_to_end_command;
|
||||
}
|
||||
@ -2967,7 +2979,10 @@ doCustom(TState *thread, CState *st, StatsData *agg)
|
||||
}
|
||||
else /* elif */
|
||||
{
|
||||
/* we should get here only if the "elif" needed evaluation */
|
||||
/*
|
||||
* we should get here only if the "elif"
|
||||
* needed evaluation
|
||||
*/
|
||||
Assert(conditional_stack_peek(st->cstack) == IFSTATE_FALSE);
|
||||
conditional_stack_poke(st->cstack, cond ? IFSTATE_TRUE : IFSTATE_FALSE);
|
||||
}
|
||||
@ -3039,10 +3054,10 @@ doCustom(TState *thread, CState *st, StatsData *agg)
|
||||
}
|
||||
|
||||
move_to_end_command:
|
||||
|
||||
/*
|
||||
* executing the expression or shell command might
|
||||
* take a non-negligible amount of time, so reset
|
||||
* 'now'
|
||||
* executing the expression or shell command might take a
|
||||
* non-negligible amount of time, so reset 'now'
|
||||
*/
|
||||
INSTR_TIME_SET_ZERO(now);
|
||||
|
||||
@ -3063,7 +3078,10 @@ doCustom(TState *thread, CState *st, StatsData *agg)
|
||||
/* cannot reach end of script in that state */
|
||||
Assert(command != NULL);
|
||||
|
||||
/* if this is conditional related, update conditional state */
|
||||
/*
|
||||
* if this is conditional related, update conditional
|
||||
* state
|
||||
*/
|
||||
if (command->type == META_COMMAND &&
|
||||
(command->meta == META_IF ||
|
||||
command->meta == META_ELIF ||
|
||||
@ -3091,7 +3109,11 @@ doCustom(TState *thread, CState *st, StatsData *agg)
|
||||
conditional_stack_pop(st->cstack);
|
||||
if (conditional_active(st->cstack))
|
||||
st->state = CSTATE_START_COMMAND;
|
||||
/* else state remains in CSTATE_SKIP_COMMAND */
|
||||
|
||||
/*
|
||||
* else state remains in
|
||||
* CSTATE_SKIP_COMMAND
|
||||
*/
|
||||
st->command++;
|
||||
}
|
||||
break;
|
||||
@ -3115,7 +3137,11 @@ doCustom(TState *thread, CState *st, StatsData *agg)
|
||||
case IFSTATE_TRUE:
|
||||
case IFSTATE_ELSE_TRUE:
|
||||
default:
|
||||
/* inconsistent if inactive, unreachable dead code */
|
||||
|
||||
/*
|
||||
* inconsistent if inactive, unreachable dead
|
||||
* code
|
||||
*/
|
||||
Assert(false);
|
||||
}
|
||||
}
|
||||
@ -4185,9 +4211,11 @@ CheckConditional(ParsedScript ps)
|
||||
/* statically check conditional structure */
|
||||
ConditionalStack cs = conditional_stack_create();
|
||||
int i;
|
||||
for (i = 0 ; ps.commands[i] != NULL ; i++)
|
||||
|
||||
for (i = 0; ps.commands[i] != NULL; i++)
|
||||
{
|
||||
Command *cmd = ps.commands[i];
|
||||
|
||||
if (cmd->type == META_COMMAND)
|
||||
{
|
||||
switch (cmd->meta)
|
||||
@ -4197,20 +4225,20 @@ CheckConditional(ParsedScript ps)
|
||||
break;
|
||||
case META_ELIF:
|
||||
if (conditional_stack_empty(cs))
|
||||
ConditionError(ps.desc, i+1, "\\elif without matching \\if");
|
||||
ConditionError(ps.desc, i + 1, "\\elif without matching \\if");
|
||||
if (conditional_stack_peek(cs) == IFSTATE_ELSE_FALSE)
|
||||
ConditionError(ps.desc, i+1, "\\elif after \\else");
|
||||
ConditionError(ps.desc, i + 1, "\\elif after \\else");
|
||||
break;
|
||||
case META_ELSE:
|
||||
if (conditional_stack_empty(cs))
|
||||
ConditionError(ps.desc, i+1, "\\else without matching \\if");
|
||||
ConditionError(ps.desc, i + 1, "\\else without matching \\if");
|
||||
if (conditional_stack_peek(cs) == IFSTATE_ELSE_FALSE)
|
||||
ConditionError(ps.desc, i+1, "\\else after \\else");
|
||||
ConditionError(ps.desc, i + 1, "\\else after \\else");
|
||||
conditional_stack_poke(cs, IFSTATE_ELSE_FALSE);
|
||||
break;
|
||||
case META_ENDIF:
|
||||
if (!conditional_stack_pop(cs))
|
||||
ConditionError(ps.desc, i+1, "\\endif without matching \\if");
|
||||
ConditionError(ps.desc, i + 1, "\\endif without matching \\if");
|
||||
break;
|
||||
default:
|
||||
/* ignore anything else... */
|
||||
@ -4219,7 +4247,7 @@ CheckConditional(ParsedScript ps)
|
||||
}
|
||||
}
|
||||
if (!conditional_stack_empty(cs))
|
||||
ConditionError(ps.desc, i+1, "\\if without matching \\endif");
|
||||
ConditionError(ps.desc, i + 1, "\\if without matching \\endif");
|
||||
conditional_stack_destroy(cs);
|
||||
}
|
||||
|
||||
@ -4679,6 +4707,7 @@ set_random_seed(const char *seed)
|
||||
{
|
||||
/* rely on current time */
|
||||
instr_time now;
|
||||
|
||||
INSTR_TIME_SET_CURRENT(now);
|
||||
iseed = (unsigned int) INSTR_TIME_GET_MICROSEC(now);
|
||||
}
|
||||
@ -4699,6 +4728,7 @@ set_random_seed(const char *seed)
|
||||
{
|
||||
/* parse seed unsigned int value */
|
||||
char garbage;
|
||||
|
||||
if (sscanf(seed, "%u%c", &iseed, &garbage) != 1)
|
||||
{
|
||||
fprintf(stderr,
|
||||
|
@ -2047,8 +2047,8 @@ command_no_begin(const char *query)
|
||||
|
||||
/*
|
||||
* Commands not allowed within transactions. The statements checked for
|
||||
* here should be exactly those that call PreventInTransactionBlock() in the
|
||||
* backend.
|
||||
* here should be exactly those that call PreventInTransactionBlock() in
|
||||
* the backend.
|
||||
*/
|
||||
if (wordlen == 6 && pg_strncasecmp(query, "vacuum", 6) == 0)
|
||||
return true;
|
||||
|
@ -247,9 +247,8 @@ MainLoop(FILE *source)
|
||||
/*
|
||||
* If we found a command word, check whether the rest of the line
|
||||
* contains only whitespace plus maybe one semicolon. If not,
|
||||
* ignore the command word after all. These commands are only
|
||||
* for compatibility with other SQL clients and are not
|
||||
* documented.
|
||||
* ignore the command word after all. These commands are only for
|
||||
* compatibility with other SQL clients and are not documented.
|
||||
*/
|
||||
if (rest_of_line != NULL)
|
||||
{
|
||||
@ -330,9 +329,8 @@ MainLoop(FILE *source)
|
||||
}
|
||||
|
||||
/*
|
||||
* If they typed "\q" in a place where "\q" is not active,
|
||||
* supply a hint. The text is still added to the query
|
||||
* buffer.
|
||||
* If they typed "\q" in a place where "\q" is not active, supply
|
||||
* a hint. The text is still added to the query buffer.
|
||||
*/
|
||||
if (found_q && query_buf->len != 0 &&
|
||||
prompt_status != PROMPT_READY &&
|
||||
|
@ -2511,6 +2511,7 @@ psql_completion(const char *text, int start, int end)
|
||||
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes,
|
||||
" UNION SELECT 'ON'"
|
||||
" UNION SELECT 'CONCURRENTLY'");
|
||||
|
||||
/*
|
||||
* Complete ... INDEX|CONCURRENTLY [<name>] ON with a list of relations
|
||||
* that can indexes can be created on
|
||||
@ -3458,7 +3459,11 @@ psql_completion(const char *text, int start, int end)
|
||||
/* Complete SET <var> with "TO" */
|
||||
else if (Matches2("SET", MatchAny))
|
||||
COMPLETE_WITH_CONST("TO");
|
||||
/* Complete ALTER DATABASE|FUNCTION||PROCEDURE|ROLE|ROUTINE|USER ... SET <name> */
|
||||
|
||||
/*
|
||||
* Complete ALTER DATABASE|FUNCTION||PROCEDURE|ROLE|ROUTINE|USER ... SET
|
||||
* <name>
|
||||
*/
|
||||
else if (HeadMatches2("ALTER", "DATABASE|FUNCTION|PROCEDURE|ROLE|ROUTINE|USER") &&
|
||||
TailMatches2("SET", MatchAny))
|
||||
COMPLETE_WITH_LIST2("FROM CURRENT", "TO");
|
||||
|
@ -77,6 +77,7 @@ conditional_stack_depth(ConditionalStack cstack)
|
||||
{
|
||||
IfStackElem *p = cstack->head;
|
||||
int depth = 0;
|
||||
|
||||
while (p != NULL)
|
||||
{
|
||||
depth++;
|
||||
|
@ -103,8 +103,8 @@ typedef struct BTMetaPageData
|
||||
BlockNumber btm_fastroot; /* current "fast" root location */
|
||||
uint32 btm_fastlevel; /* tree level of the "fast" root page */
|
||||
/* following fields are available since page version 3 */
|
||||
TransactionId btm_oldest_btpo_xact; /* oldest btpo_xact among of
|
||||
* deleted pages */
|
||||
TransactionId btm_oldest_btpo_xact; /* oldest btpo_xact among of deleted
|
||||
* pages */
|
||||
float8 btm_last_cleanup_num_heap_tuples; /* number of heap tuples
|
||||
* during last cleanup */
|
||||
} BTMetaPageData;
|
||||
|
@ -51,7 +51,7 @@ typedef enum relopt_kind
|
||||
RELOPT_KIND_PARTITIONED = (1 << 11),
|
||||
/* if you add a new kind, make sure you update "last_default" too */
|
||||
RELOPT_KIND_LAST_DEFAULT = RELOPT_KIND_PARTITIONED,
|
||||
RELOPT_KIND_INDEX = RELOPT_KIND_BTREE|RELOPT_KIND_HASH|RELOPT_KIND_GIN|RELOPT_KIND_SPGIST,
|
||||
RELOPT_KIND_INDEX = RELOPT_KIND_BTREE | RELOPT_KIND_HASH | RELOPT_KIND_GIN | RELOPT_KIND_SPGIST,
|
||||
/* some compilers treat enums as signed ints, so we can't use 1 << 31 */
|
||||
RELOPT_KIND_MAX = (1 << 30)
|
||||
} relopt_kind;
|
||||
|
@ -67,7 +67,8 @@ CATALOG(pg_class,1259,RelationRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83,Relat
|
||||
bool relispopulated; /* matview currently holds query results */
|
||||
char relreplident; /* see REPLICA_IDENTITY_xxx constants */
|
||||
bool relispartition; /* is relation a partition? */
|
||||
Oid relrewrite; /* heap for rewrite during DDL, link to original rel */
|
||||
Oid relrewrite; /* heap for rewrite during DDL, link to
|
||||
* original rel */
|
||||
TransactionId relfrozenxid; /* all Xids < this are frozen in this rel */
|
||||
TransactionId relminmxid; /* all multixacts in this rel are >= this.
|
||||
* this is really a MultiXactId */
|
||||
|
@ -38,8 +38,10 @@ typedef struct
|
||||
QueryEnvironment *queryEnv; /* query environment setup for SPI level */
|
||||
|
||||
/* transaction management support */
|
||||
bool atomic; /* atomic execution context, does not allow transactions */
|
||||
bool internal_xact; /* SPI-managed transaction boundary, skip cleanup */
|
||||
bool atomic; /* atomic execution context, does not allow
|
||||
* transactions */
|
||||
bool internal_xact; /* SPI-managed transaction boundary, skip
|
||||
* cleanup */
|
||||
} _SPI_connection;
|
||||
|
||||
/*
|
||||
|
@ -502,8 +502,8 @@ typedef struct EState
|
||||
int es_num_root_result_relations; /* length of the array */
|
||||
|
||||
/*
|
||||
* The following list contains ResultRelInfos created by the tuple
|
||||
* routing code for partitions that don't already have one.
|
||||
* The following list contains ResultRelInfos created by the tuple routing
|
||||
* code for partitions that don't already have one.
|
||||
*/
|
||||
List *es_tuple_routing_result_relations;
|
||||
|
||||
@ -836,7 +836,8 @@ typedef struct SubPlanState
|
||||
MemoryContext hashtempcxt; /* temp memory context for hash tables */
|
||||
ExprContext *innerecontext; /* econtext for computing inner tuples */
|
||||
AttrNumber *keyColIdx; /* control data for hash tables */
|
||||
Oid *tab_eq_funcoids;/* equality func oids for table datatype(s) */
|
||||
Oid *tab_eq_funcoids; /* equality func oids for table
|
||||
* datatype(s) */
|
||||
FmgrInfo *tab_hash_funcs; /* hash functions for table datatype(s) */
|
||||
FmgrInfo *tab_eq_funcs; /* equality functions for table datatype(s) */
|
||||
FmgrInfo *lhs_hash_funcs; /* hash functions for lefthand datatype(s) */
|
||||
|
@ -655,8 +655,8 @@ typedef struct ColumnDef
|
||||
Node *raw_default; /* default value (untransformed parse tree) */
|
||||
Node *cooked_default; /* default value (transformed expr tree) */
|
||||
char identity; /* attidentity setting */
|
||||
RangeVar *identitySequence; /* to store identity sequence name for ALTER
|
||||
* TABLE ... ADD COLUMN */
|
||||
RangeVar *identitySequence; /* to store identity sequence name for
|
||||
* ALTER TABLE ... ADD COLUMN */
|
||||
CollateClause *collClause; /* untransformed COLLATE spec, if any */
|
||||
Oid collOid; /* collation OID (InvalidOid if not set) */
|
||||
List *constraints; /* other constraints on column */
|
||||
|
@ -46,8 +46,8 @@ typedef struct LogicalDecodingContext
|
||||
struct SnapBuild *snapshot_builder;
|
||||
|
||||
/*
|
||||
* Marks the logical decoding context as fast forward decoding one.
|
||||
* Such a context does not have plugin loaded so most of the the following
|
||||
* Marks the logical decoding context as fast forward decoding one. Such a
|
||||
* context does not have plugin loaded so most of the the following
|
||||
* properties are unused.
|
||||
*/
|
||||
bool fast_forward;
|
||||
|
@ -101,8 +101,8 @@ typedef struct ReorderBufferChange
|
||||
} tp;
|
||||
|
||||
/*
|
||||
* Truncate data for REORDER_BUFFER_CHANGE_TRUNCATE representing
|
||||
* one set of relations to be truncated.
|
||||
* Truncate data for REORDER_BUFFER_CHANGE_TRUNCATE representing one
|
||||
* set of relations to be truncated.
|
||||
*/
|
||||
struct
|
||||
{
|
||||
|
@ -110,8 +110,8 @@ typedef struct
|
||||
char conninfo[MAXCONNINFO];
|
||||
|
||||
/*
|
||||
* Host name (this can be a host name, an IP address, or a directory
|
||||
* path) and port number of the active replication connection.
|
||||
* Host name (this can be a host name, an IP address, or a directory path)
|
||||
* and port number of the active replication connection.
|
||||
*/
|
||||
char sender_host[NI_MAXHOST];
|
||||
int sender_port;
|
||||
|
@ -20,7 +20,8 @@ typedef enum
|
||||
{
|
||||
PROCESS_UTILITY_TOPLEVEL, /* toplevel interactive command */
|
||||
PROCESS_UTILITY_QUERY, /* a complete query, but not toplevel */
|
||||
PROCESS_UTILITY_QUERY_NONATOMIC, /* a complete query, nonatomic execution context */
|
||||
PROCESS_UTILITY_QUERY_NONATOMIC, /* a complete query, nonatomic
|
||||
* execution context */
|
||||
PROCESS_UTILITY_SUBCOMMAND /* a portion of a query */
|
||||
} ProcessUtilityContext;
|
||||
|
||||
|
@ -136,7 +136,8 @@ extern bool IsValidJsonNumber(const char *str, int len);
|
||||
* Flag types for iterate_json(b)_values to specify what elements from a
|
||||
* json(b) document we want to iterate.
|
||||
*/
|
||||
typedef enum JsonToIndex {
|
||||
typedef enum JsonToIndex
|
||||
{
|
||||
jtiKey = 0x01,
|
||||
jtiString = 0x02,
|
||||
jtiNumeric = 0x04,
|
||||
|
@ -116,7 +116,7 @@ typedef struct PortalData
|
||||
/* Bookkeeping data */
|
||||
const char *name; /* portal's name */
|
||||
const char *prepStmtName; /* source prepared statement (NULL if none) */
|
||||
MemoryContext portalContext;/* subsidiary memory for portal */
|
||||
MemoryContext portalContext; /* subsidiary memory for portal */
|
||||
ResourceOwner resowner; /* resources owned by portal */
|
||||
void (*cleanup) (Portal portal); /* cleanup hook */
|
||||
|
||||
|
@ -464,15 +464,22 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
||||
|
||||
if (varcharsize == 0 || varcharsize > size)
|
||||
{
|
||||
/* compatibility mode, blank pad and null terminate char array */
|
||||
/*
|
||||
* compatibility mode, blank pad and null
|
||||
* terminate char array
|
||||
*/
|
||||
if (ORACLE_MODE(compat) && (type == ECPGt_char || type == ECPGt_unsigned_char))
|
||||
{
|
||||
memset(str, ' ', varcharsize);
|
||||
memcpy(str, pval, size);
|
||||
str[varcharsize-1] = '\0';
|
||||
str[varcharsize - 1] = '\0';
|
||||
|
||||
/* compatibility mode empty string gets -1 indicator but no warning */
|
||||
if (size == 0) {
|
||||
/*
|
||||
* compatibility mode empty string gets -1
|
||||
* indicator but no warning
|
||||
*/
|
||||
if (size == 0)
|
||||
{
|
||||
/* truncation */
|
||||
switch (ind_type)
|
||||
{
|
||||
@ -488,12 +495,12 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
||||
case ECPGt_unsigned_long:
|
||||
*((long *) (ind + ind_offset * act_tuple)) = -1;
|
||||
break;
|
||||
#ifdef HAVE_LONG_LONG_INT
|
||||
#ifdef HAVE_LONG_LONG_INT
|
||||
case ECPGt_long_long:
|
||||
case ECPGt_unsigned_long_long:
|
||||
*((long long int *) (ind + ind_offset * act_tuple)) = -1;
|
||||
break;
|
||||
#endif /* HAVE_LONG_LONG_INT */
|
||||
#endif /* HAVE_LONG_LONG_INT */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -523,7 +530,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
||||
if (ORACLE_MODE(compat) && (varcharsize - 1) < size)
|
||||
{
|
||||
if (type == ECPGt_char || type == ECPGt_unsigned_char)
|
||||
str[varcharsize-1] = '\0';
|
||||
str[varcharsize - 1] = '\0';
|
||||
}
|
||||
|
||||
if (varcharsize < size || (ORACLE_MODE(compat) && (varcharsize - 1) < size))
|
||||
|
@ -479,7 +479,8 @@ main(int argc, char *const argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (output_filename && out_option == 0) {
|
||||
if (output_filename && out_option == 0)
|
||||
{
|
||||
free(output_filename);
|
||||
output_filename = NULL;
|
||||
}
|
||||
|
@ -611,14 +611,16 @@ ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, char *arrsize
|
||||
if (ind_p != NULL && ind_p != &struct_no_indicator)
|
||||
{
|
||||
ind_p = ind_p->next;
|
||||
if (ind_p == NULL && p->next != NULL) {
|
||||
if (ind_p == NULL && p->next != NULL)
|
||||
{
|
||||
mmerror(PARSE_ERROR, ET_WARNING, "indicator struct \"%s\" has too few members", ind_name);
|
||||
ind_p = &struct_no_indicator;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ind_type != NULL && ind_p != NULL && ind_p != &struct_no_indicator) {
|
||||
if (ind_type != NULL && ind_p != NULL && ind_p != &struct_no_indicator)
|
||||
{
|
||||
mmerror(PARSE_ERROR, ET_WARNING, "indicator struct \"%s\" has too many members", ind_name);
|
||||
}
|
||||
|
||||
|
@ -1194,6 +1194,7 @@ initialize_SSL(PGconn *conn)
|
||||
#ifdef SSL_OP_NO_COMPRESSION
|
||||
if (conn->sslcompression && conn->sslcompression[0] == '0')
|
||||
SSL_set_options(conn->ssl, SSL_OP_NO_COMPRESSION);
|
||||
|
||||
/*
|
||||
* Mainline OpenSSL introduced SSL_clear_options() before
|
||||
* SSL_OP_NO_COMPRESSION, so this following #ifdef should not be
|
||||
|
@ -563,9 +563,9 @@ do_compile(FunctionCallInfo fcinfo,
|
||||
function->fn_rettyplen = typeStruct->typlen;
|
||||
|
||||
/*
|
||||
* install $0 reference, but only for polymorphic return
|
||||
* types, and not when the return is specified through an
|
||||
* output parameter.
|
||||
* install $0 reference, but only for polymorphic return types,
|
||||
* and not when the return is specified through an output
|
||||
* parameter.
|
||||
*/
|
||||
if (IsPolymorphicType(procStruct->prorettype) &&
|
||||
num_out_args == 0)
|
||||
|
@ -2183,7 +2183,7 @@ exec_stmt_call(PLpgSQL_execstate *estate, PLpgSQL_stmt_call *stmt)
|
||||
|
||||
nfields = 0;
|
||||
i = 0;
|
||||
foreach (lc, funcexpr->args)
|
||||
foreach(lc, funcexpr->args)
|
||||
{
|
||||
Node *n = lfirst(lc);
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user