mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
Initial pgindent and pgperltidy run for v14.
Also "make reformat-dat-files". The only change worthy of note is that pgindent messed up the formatting of launcher.c's struct LogicalRepWorkerId, which led me to notice that that struct wasn't used at all anymore, so I just took it out.
This commit is contained in:
@ -51,8 +51,7 @@ detects_heap_corruption(
|
||||
#
|
||||
fresh_test_table('test');
|
||||
$node->safe_psql('postgres', q(VACUUM (FREEZE, DISABLE_PAGE_SKIPPING) test));
|
||||
detects_no_corruption(
|
||||
"verify_heapam('test')",
|
||||
detects_no_corruption("verify_heapam('test')",
|
||||
"all-frozen not corrupted table");
|
||||
corrupt_first_page('test');
|
||||
detects_heap_corruption("verify_heapam('test')",
|
||||
|
@ -839,13 +839,16 @@ check_tuple_visibility(HeapCheckContext *ctx)
|
||||
return false;
|
||||
|
||||
case XID_COMMITTED:
|
||||
|
||||
/*
|
||||
* The tuple is dead, because the xvac transaction moved
|
||||
* it off and committed. It's checkable, but also prunable.
|
||||
* it off and committed. It's checkable, but also
|
||||
* prunable.
|
||||
*/
|
||||
return true;
|
||||
|
||||
case XID_ABORTED:
|
||||
|
||||
/*
|
||||
* The original xmin must have committed, because the xvac
|
||||
* transaction tried to move it later. Since xvac is
|
||||
@ -905,6 +908,7 @@ check_tuple_visibility(HeapCheckContext *ctx)
|
||||
return false;
|
||||
|
||||
case XID_COMMITTED:
|
||||
|
||||
/*
|
||||
* The original xmin must have committed, because the xvac
|
||||
* transaction moved it later. Whether it's still alive
|
||||
@ -913,9 +917,11 @@ check_tuple_visibility(HeapCheckContext *ctx)
|
||||
break;
|
||||
|
||||
case XID_ABORTED:
|
||||
|
||||
/*
|
||||
* The tuple is dead, because the xvac transaction moved
|
||||
* it off and committed. It's checkable, but also prunable.
|
||||
* it off and committed. It's checkable, but also
|
||||
* prunable.
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
@ -924,12 +930,12 @@ check_tuple_visibility(HeapCheckContext *ctx)
|
||||
{
|
||||
/*
|
||||
* Inserting transaction is not in progress, and not committed, so
|
||||
* it might have changed the TupleDesc in ways we don't know about.
|
||||
* Thus, don't try to check the tuple structure.
|
||||
* it might have changed the TupleDesc in ways we don't know
|
||||
* about. Thus, don't try to check the tuple structure.
|
||||
*
|
||||
* If xmin_status happens to be XID_IS_CURRENT_XID, then in theory
|
||||
* any such DDL changes ought to be visible to us, so perhaps
|
||||
* we could check anyway in that case. But, for now, let's be
|
||||
* any such DDL changes ought to be visible to us, so perhaps we
|
||||
* could check anyway in that case. But, for now, let's be
|
||||
* conservative and treat this like any other uncommitted insert.
|
||||
*/
|
||||
return false;
|
||||
@ -945,18 +951,19 @@ check_tuple_visibility(HeapCheckContext *ctx)
|
||||
{
|
||||
/*
|
||||
* xmax is a multixact, so sanity-check the MXID. Note that we do this
|
||||
* prior to checking for HEAP_XMAX_INVALID or HEAP_XMAX_IS_LOCKED_ONLY.
|
||||
* This might therefore complain about things that wouldn't actually
|
||||
* be a problem during a normal scan, but eventually we're going to
|
||||
* have to freeze, and that process will ignore hint bits.
|
||||
* prior to checking for HEAP_XMAX_INVALID or
|
||||
* HEAP_XMAX_IS_LOCKED_ONLY. This might therefore complain about
|
||||
* things that wouldn't actually be a problem during a normal scan,
|
||||
* but eventually we're going to have to freeze, and that process will
|
||||
* ignore hint bits.
|
||||
*
|
||||
* Even if the MXID is out of range, we still know that the original
|
||||
* insert committed, so we can check the tuple itself. However, we
|
||||
* can't rule out the possibility that this tuple is dead, so don't
|
||||
* clear ctx->tuple_could_be_pruned. Possibly we should go ahead and
|
||||
* clear that flag anyway if HEAP_XMAX_INVALID is set or if
|
||||
* HEAP_XMAX_IS_LOCKED_ONLY is true, but for now we err on the side
|
||||
* of avoiding possibly-bogus complaints about missing TOAST entries.
|
||||
* HEAP_XMAX_IS_LOCKED_ONLY is true, but for now we err on the side of
|
||||
* avoiding possibly-bogus complaints about missing TOAST entries.
|
||||
*/
|
||||
xmax = HeapTupleHeaderGetRawXmax(tuphdr);
|
||||
switch (check_mxid_valid_in_rel(xmax, ctx))
|
||||
@ -1066,9 +1073,10 @@ check_tuple_visibility(HeapCheckContext *ctx)
|
||||
* away depends on how old the deleting transaction is.
|
||||
*/
|
||||
ctx->tuple_could_be_pruned = TransactionIdPrecedes(xmax,
|
||||
ctx->safe_xmin);
|
||||
ctx->safe_xmin);
|
||||
break;
|
||||
case XID_ABORTED:
|
||||
|
||||
/*
|
||||
* The delete aborted or crashed. The tuple is still live.
|
||||
*/
|
||||
@ -1127,15 +1135,17 @@ check_tuple_visibility(HeapCheckContext *ctx)
|
||||
break;
|
||||
|
||||
case XID_COMMITTED:
|
||||
|
||||
/*
|
||||
* The delete committed. Whether the toast can be vacuumed away
|
||||
* depends on how old the deleting transaction is.
|
||||
*/
|
||||
ctx->tuple_could_be_pruned = TransactionIdPrecedes(xmax,
|
||||
ctx->safe_xmin);
|
||||
ctx->safe_xmin);
|
||||
break;
|
||||
|
||||
case XID_ABORTED:
|
||||
|
||||
/*
|
||||
* The delete aborted or crashed. The tuple is still live.
|
||||
*/
|
||||
@ -1248,6 +1258,7 @@ check_toast_tuple(HeapTuple toasttup, HeapCheckContext *ctx,
|
||||
ta->toast_pointer.va_valueid,
|
||||
chunk_seq, chunksize, expected_size));
|
||||
}
|
||||
|
||||
/*
|
||||
* Check the current attribute as tracked in ctx, recording any corruption
|
||||
* found in ctx->tupstore.
|
||||
|
@ -536,7 +536,7 @@ bt_check_every_level(Relation rel, Relation heaprel, bool heapkeyspace,
|
||||
ereport(DEBUG1,
|
||||
(errcode(ERRCODE_NO_DATA),
|
||||
errmsg_internal("harmless fast root mismatch in index \"%s\"",
|
||||
RelationGetRelationName(rel)),
|
||||
RelationGetRelationName(rel)),
|
||||
errdetail_internal("Fast root block %u (level %u) differs from true root block %u (level %u).",
|
||||
metad->btm_fastroot, metad->btm_fastlevel,
|
||||
metad->btm_root, metad->btm_level)));
|
||||
@ -722,7 +722,7 @@ bt_check_level_from_leftmost(BtreeCheckState *state, BtreeLevel level)
|
||||
ereport(DEBUG1,
|
||||
(errcode(ERRCODE_NO_DATA),
|
||||
errmsg_internal("block %u of index \"%s\" concurrently deleted",
|
||||
current, RelationGetRelationName(state->rel))));
|
||||
current, RelationGetRelationName(state->rel))));
|
||||
goto nextpage;
|
||||
}
|
||||
else if (nextleveldown.leftmost == InvalidBlockNumber)
|
||||
@ -918,7 +918,7 @@ bt_recheck_sibling_links(BtreeCheckState *state,
|
||||
Buffer newtargetbuf;
|
||||
Page page;
|
||||
BTPageOpaque opaque;
|
||||
BlockNumber newtargetblock;
|
||||
BlockNumber newtargetblock;
|
||||
|
||||
/* Couple locks in the usual order for nbtree: Left to right */
|
||||
lbuf = ReadBufferExtended(state->rel, MAIN_FORKNUM, leftcurrent,
|
||||
@ -980,7 +980,7 @@ bt_recheck_sibling_links(BtreeCheckState *state,
|
||||
ereport(DEBUG1,
|
||||
(errcode(ERRCODE_INTERNAL_ERROR),
|
||||
errmsg_internal("harmless concurrent page split detected in index \"%s\"",
|
||||
RelationGetRelationName(state->rel)),
|
||||
RelationGetRelationName(state->rel)),
|
||||
errdetail_internal("Block=%u new right sibling=%u original right sibling=%u.",
|
||||
leftcurrent, newtargetblock,
|
||||
state->targetblock)));
|
||||
@ -1599,7 +1599,7 @@ bt_right_page_check_scankey(BtreeCheckState *state)
|
||||
ereport(DEBUG2,
|
||||
(errcode(ERRCODE_NO_DATA),
|
||||
errmsg_internal("level %u sibling page in block %u of index \"%s\" was found deleted or half dead",
|
||||
opaque->btpo_level, targetnext, RelationGetRelationName(state->rel)),
|
||||
opaque->btpo_level, targetnext, RelationGetRelationName(state->rel)),
|
||||
errdetail_internal("Deleted page found when building scankey from right sibling.")));
|
||||
|
||||
targetnext = opaque->btpo_next;
|
||||
@ -1729,8 +1729,8 @@ bt_right_page_check_scankey(BtreeCheckState *state)
|
||||
ereport(DEBUG2,
|
||||
(errcode(ERRCODE_NO_DATA),
|
||||
errmsg_internal("%s block %u of index \"%s\" has no first data item",
|
||||
P_ISLEAF(opaque) ? "leaf" : "internal", targetnext,
|
||||
RelationGetRelationName(state->rel))));
|
||||
P_ISLEAF(opaque) ? "leaf" : "internal", targetnext,
|
||||
RelationGetRelationName(state->rel))));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -2278,7 +2278,7 @@ bt_downlink_missing_check(BtreeCheckState *state, bool rightsplit,
|
||||
ereport(DEBUG1,
|
||||
(errcode(ERRCODE_NO_DATA),
|
||||
errmsg_internal("harmless interrupted page split detected in index \"%s\"",
|
||||
RelationGetRelationName(state->rel)),
|
||||
RelationGetRelationName(state->rel)),
|
||||
errdetail_internal("Block=%u level=%u left sibling=%u page lsn=%X/%X.",
|
||||
blkno, opaque->btpo_level,
|
||||
opaque->btpo_prev,
|
||||
|
@ -25,11 +25,11 @@
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int current_index;
|
||||
int head_offset;
|
||||
TimestampTz head_timestamp;
|
||||
int count_used;
|
||||
TransactionId xid_by_minute[FLEXIBLE_ARRAY_MEMBER];
|
||||
int current_index;
|
||||
int head_offset;
|
||||
TimestampTz head_timestamp;
|
||||
int count_used;
|
||||
TransactionId xid_by_minute[FLEXIBLE_ARRAY_MEMBER];
|
||||
} OldSnapshotTimeMapping;
|
||||
|
||||
#define NUM_TIME_MAPPING_COLUMNS 3
|
||||
@ -53,7 +53,7 @@ pg_old_snapshot_time_mapping(PG_FUNCTION_ARGS)
|
||||
|
||||
if (SRF_IS_FIRSTCALL())
|
||||
{
|
||||
MemoryContext oldcontext;
|
||||
MemoryContext oldcontext;
|
||||
|
||||
funcctx = SRF_FIRSTCALL_INIT();
|
||||
oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
|
||||
@ -127,24 +127,25 @@ MakeOldSnapshotTimeMappingTupleDesc(void)
|
||||
static HeapTuple
|
||||
MakeOldSnapshotTimeMappingTuple(TupleDesc tupdesc, OldSnapshotTimeMapping *mapping)
|
||||
{
|
||||
Datum values[NUM_TIME_MAPPING_COLUMNS];
|
||||
bool nulls[NUM_TIME_MAPPING_COLUMNS];
|
||||
int array_position;
|
||||
TimestampTz timestamp;
|
||||
Datum values[NUM_TIME_MAPPING_COLUMNS];
|
||||
bool nulls[NUM_TIME_MAPPING_COLUMNS];
|
||||
int array_position;
|
||||
TimestampTz timestamp;
|
||||
|
||||
/*
|
||||
* Figure out the array position corresponding to the current index.
|
||||
*
|
||||
* Index 0 means the oldest entry in the mapping, which is stored at
|
||||
* mapping->head_offset. Index 1 means the next-oldest entry, which is a the
|
||||
* following index, and so on. We wrap around when we reach the end of the array.
|
||||
* mapping->head_offset. Index 1 means the next-oldest entry, which is a
|
||||
* the following index, and so on. We wrap around when we reach the end of
|
||||
* the array.
|
||||
*/
|
||||
array_position = (mapping->head_offset + mapping->current_index)
|
||||
% OLD_SNAPSHOT_TIME_MAP_ENTRIES;
|
||||
|
||||
/*
|
||||
* No explicit timestamp is stored for any entry other than the oldest one,
|
||||
* but each entry corresponds to 1-minute period, so we can just add.
|
||||
* No explicit timestamp is stored for any entry other than the oldest
|
||||
* one, but each entry corresponds to 1-minute period, so we can just add.
|
||||
*/
|
||||
timestamp = TimestampTzPlusMilliseconds(mapping->head_timestamp,
|
||||
mapping->current_index * 60000);
|
||||
|
@ -1074,9 +1074,10 @@ pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
||||
* Force utility statements to get queryId zero. We do this even in cases
|
||||
* where the statement contains an optimizable statement for which a
|
||||
* queryId could be derived (such as EXPLAIN or DECLARE CURSOR). For such
|
||||
* cases, runtime control will first go through ProcessUtility and then the
|
||||
* executor, and we don't want the executor hooks to do anything, since we
|
||||
* are already measuring the statement's costs at the utility level.
|
||||
* cases, runtime control will first go through ProcessUtility and then
|
||||
* the executor, and we don't want the executor hooks to do anything,
|
||||
* since we are already measuring the statement's costs at the utility
|
||||
* level.
|
||||
*
|
||||
* Note that this is only done if pg_stat_statements is enabled and
|
||||
* configured to track utility statements, in the unlikely possibility
|
||||
|
@ -1779,7 +1779,8 @@ rebuildInsertSql(StringInfo buf, char *orig_query,
|
||||
int values_end_len, int num_cols,
|
||||
int num_rows)
|
||||
{
|
||||
int i, j;
|
||||
int i,
|
||||
j;
|
||||
int pindex;
|
||||
bool first;
|
||||
|
||||
@ -1790,8 +1791,8 @@ rebuildInsertSql(StringInfo buf, char *orig_query,
|
||||
appendBinaryStringInfo(buf, orig_query, values_end_len);
|
||||
|
||||
/*
|
||||
* Add records to VALUES clause (we already have parameters for the
|
||||
* first row, so start at the right offset).
|
||||
* Add records to VALUES clause (we already have parameters for the first
|
||||
* row, so start at the right offset).
|
||||
*/
|
||||
pindex = num_cols + 1;
|
||||
for (i = 0; i < num_rows; i++)
|
||||
|
@ -146,7 +146,7 @@ typedef struct PgFdwScanState
|
||||
|
||||
/* for remote query execution */
|
||||
PGconn *conn; /* connection for the scan */
|
||||
PgFdwConnState *conn_state; /* extra per-connection state */
|
||||
PgFdwConnState *conn_state; /* extra per-connection state */
|
||||
unsigned int cursor_number; /* quasi-unique ID for my cursor */
|
||||
bool cursor_exists; /* have we created the cursor? */
|
||||
int numParams; /* number of parameters passed to query */
|
||||
@ -164,7 +164,7 @@ typedef struct PgFdwScanState
|
||||
bool eof_reached; /* true if last fetch reached EOF */
|
||||
|
||||
/* for asynchronous execution */
|
||||
bool async_capable; /* engage asynchronous-capable logic? */
|
||||
bool async_capable; /* engage asynchronous-capable logic? */
|
||||
|
||||
/* working memory contexts */
|
||||
MemoryContext batch_cxt; /* context holding current batch of tuples */
|
||||
@ -183,7 +183,7 @@ typedef struct PgFdwModifyState
|
||||
|
||||
/* for remote query execution */
|
||||
PGconn *conn; /* connection for the scan */
|
||||
PgFdwConnState *conn_state; /* extra per-connection state */
|
||||
PgFdwConnState *conn_state; /* extra per-connection state */
|
||||
char *p_name; /* name of prepared statement, if created */
|
||||
|
||||
/* extracted fdw_private data */
|
||||
@ -227,7 +227,7 @@ typedef struct PgFdwDirectModifyState
|
||||
|
||||
/* for remote query execution */
|
||||
PGconn *conn; /* connection for the update */
|
||||
PgFdwConnState *conn_state; /* extra per-connection state */
|
||||
PgFdwConnState *conn_state; /* extra per-connection state */
|
||||
int numParams; /* number of parameters passed to query */
|
||||
FmgrInfo *param_flinfo; /* output conversion functions for them */
|
||||
List *param_exprs; /* executable expressions for param values */
|
||||
@ -364,10 +364,10 @@ static TupleTableSlot *postgresExecForeignInsert(EState *estate,
|
||||
TupleTableSlot *slot,
|
||||
TupleTableSlot *planSlot);
|
||||
static TupleTableSlot **postgresExecForeignBatchInsert(EState *estate,
|
||||
ResultRelInfo *resultRelInfo,
|
||||
TupleTableSlot **slots,
|
||||
TupleTableSlot **planSlots,
|
||||
int *numSlots);
|
||||
ResultRelInfo *resultRelInfo,
|
||||
TupleTableSlot **slots,
|
||||
TupleTableSlot **planSlots,
|
||||
int *numSlots);
|
||||
static int postgresGetForeignModifyBatchSize(ResultRelInfo *resultRelInfo);
|
||||
static TupleTableSlot *postgresExecForeignUpdate(EState *estate,
|
||||
ResultRelInfo *resultRelInfo,
|
||||
@ -467,11 +467,11 @@ static PgFdwModifyState *create_foreign_modify(EState *estate,
|
||||
bool has_returning,
|
||||
List *retrieved_attrs);
|
||||
static TupleTableSlot **execute_foreign_modify(EState *estate,
|
||||
ResultRelInfo *resultRelInfo,
|
||||
CmdType operation,
|
||||
TupleTableSlot **slots,
|
||||
TupleTableSlot **planSlots,
|
||||
int *numSlots);
|
||||
ResultRelInfo *resultRelInfo,
|
||||
CmdType operation,
|
||||
TupleTableSlot **slots,
|
||||
TupleTableSlot **planSlots,
|
||||
int *numSlots);
|
||||
static void prepare_foreign_modify(PgFdwModifyState *fmstate);
|
||||
static const char **convert_prep_stmt_params(PgFdwModifyState *fmstate,
|
||||
ItemPointer tupleid,
|
||||
@ -545,7 +545,7 @@ static void apply_table_options(PgFdwRelationInfo *fpinfo);
|
||||
static void merge_fdw_options(PgFdwRelationInfo *fpinfo,
|
||||
const PgFdwRelationInfo *fpinfo_o,
|
||||
const PgFdwRelationInfo *fpinfo_i);
|
||||
static int get_batch_size_option(Relation rel);
|
||||
static int get_batch_size_option(Relation rel);
|
||||
|
||||
|
||||
/*
|
||||
@ -1870,7 +1870,7 @@ postgresBeginForeignModify(ModifyTableState *mtstate,
|
||||
target_attrs = (List *) list_nth(fdw_private,
|
||||
FdwModifyPrivateTargetAttnums);
|
||||
values_end_len = intVal(list_nth(fdw_private,
|
||||
FdwModifyPrivateLen));
|
||||
FdwModifyPrivateLen));
|
||||
has_returning = intVal(list_nth(fdw_private,
|
||||
FdwModifyPrivateHasReturning));
|
||||
retrieved_attrs = (List *) list_nth(fdw_private,
|
||||
@ -1907,7 +1907,7 @@ postgresExecForeignInsert(EState *estate,
|
||||
{
|
||||
PgFdwModifyState *fmstate = (PgFdwModifyState *) resultRelInfo->ri_FdwState;
|
||||
TupleTableSlot **rslot;
|
||||
int numSlots = 1;
|
||||
int numSlots = 1;
|
||||
|
||||
/*
|
||||
* If the fmstate has aux_fmstate set, use the aux_fmstate (see
|
||||
@ -1930,10 +1930,10 @@ postgresExecForeignInsert(EState *estate,
|
||||
*/
|
||||
static TupleTableSlot **
|
||||
postgresExecForeignBatchInsert(EState *estate,
|
||||
ResultRelInfo *resultRelInfo,
|
||||
TupleTableSlot **slots,
|
||||
TupleTableSlot **planSlots,
|
||||
int *numSlots)
|
||||
ResultRelInfo *resultRelInfo,
|
||||
TupleTableSlot **slots,
|
||||
TupleTableSlot **planSlots,
|
||||
int *numSlots)
|
||||
{
|
||||
PgFdwModifyState *fmstate = (PgFdwModifyState *) resultRelInfo->ri_FdwState;
|
||||
TupleTableSlot **rslot;
|
||||
@ -1964,17 +1964,17 @@ postgresExecForeignBatchInsert(EState *estate,
|
||||
static int
|
||||
postgresGetForeignModifyBatchSize(ResultRelInfo *resultRelInfo)
|
||||
{
|
||||
int batch_size;
|
||||
int batch_size;
|
||||
PgFdwModifyState *fmstate = resultRelInfo->ri_FdwState ?
|
||||
(PgFdwModifyState *) resultRelInfo->ri_FdwState :
|
||||
NULL;
|
||||
(PgFdwModifyState *) resultRelInfo->ri_FdwState :
|
||||
NULL;
|
||||
|
||||
/* should be called only once */
|
||||
Assert(resultRelInfo->ri_BatchSize == 0);
|
||||
|
||||
/*
|
||||
* Should never get called when the insert is being performed as part of
|
||||
* a row movement operation.
|
||||
* Should never get called when the insert is being performed as part of a
|
||||
* row movement operation.
|
||||
*/
|
||||
Assert(fmstate == NULL || fmstate->aux_fmstate == NULL);
|
||||
|
||||
@ -2009,10 +2009,10 @@ postgresExecForeignUpdate(EState *estate,
|
||||
TupleTableSlot *planSlot)
|
||||
{
|
||||
TupleTableSlot **rslot;
|
||||
int numSlots = 1;
|
||||
int numSlots = 1;
|
||||
|
||||
rslot = execute_foreign_modify(estate, resultRelInfo, CMD_UPDATE,
|
||||
&slot, &planSlot, &numSlots);
|
||||
&slot, &planSlot, &numSlots);
|
||||
|
||||
return rslot ? rslot[0] : NULL;
|
||||
}
|
||||
@ -2028,10 +2028,10 @@ postgresExecForeignDelete(EState *estate,
|
||||
TupleTableSlot *planSlot)
|
||||
{
|
||||
TupleTableSlot **rslot;
|
||||
int numSlots = 1;
|
||||
int numSlots = 1;
|
||||
|
||||
rslot = execute_foreign_modify(estate, resultRelInfo, CMD_DELETE,
|
||||
&slot, &planSlot, &numSlots);
|
||||
&slot, &planSlot, &numSlots);
|
||||
|
||||
return rslot ? rslot[0] : NULL;
|
||||
}
|
||||
@ -2117,13 +2117,13 @@ postgresBeginForeignInsert(ModifyTableState *mtstate,
|
||||
|
||||
/*
|
||||
* If the foreign table is a partition that doesn't have a corresponding
|
||||
* RTE entry, we need to create a new RTE
|
||||
* describing the foreign table for use by deparseInsertSql and
|
||||
* create_foreign_modify() below, after first copying the parent's RTE and
|
||||
* modifying some fields to describe the foreign partition to work on.
|
||||
* However, if this is invoked by UPDATE, the existing RTE may already
|
||||
* correspond to this partition if it is one of the UPDATE subplan target
|
||||
* rels; in that case, we can just use the existing RTE as-is.
|
||||
* RTE entry, we need to create a new RTE describing the foreign table for
|
||||
* use by deparseInsertSql and create_foreign_modify() below, after first
|
||||
* copying the parent's RTE and modifying some fields to describe the
|
||||
* foreign partition to work on. However, if this is invoked by UPDATE,
|
||||
* the existing RTE may already correspond to this partition if it is one
|
||||
* of the UPDATE subplan target rels; in that case, we can just use the
|
||||
* existing RTE as-is.
|
||||
*/
|
||||
if (resultRelInfo->ri_RangeTableIndex == 0)
|
||||
{
|
||||
@ -2847,8 +2847,8 @@ postgresExplainForeignModify(ModifyTableState *mtstate,
|
||||
ExplainPropertyText("Remote SQL", sql, es);
|
||||
|
||||
/*
|
||||
* For INSERT we should always have batch size >= 1, but UPDATE
|
||||
* and DELETE don't support batching so don't show the property.
|
||||
* For INSERT we should always have batch size >= 1, but UPDATE and
|
||||
* DELETE don't support batching so don't show the property.
|
||||
*/
|
||||
if (rinfo->ri_BatchSize > 0)
|
||||
ExplainPropertyInteger("Batch Size", NULL, rinfo->ri_BatchSize, es);
|
||||
@ -7255,18 +7255,18 @@ find_em_expr_for_input_target(PlannerInfo *root,
|
||||
static int
|
||||
get_batch_size_option(Relation rel)
|
||||
{
|
||||
Oid foreigntableid = RelationGetRelid(rel);
|
||||
Oid foreigntableid = RelationGetRelid(rel);
|
||||
ForeignTable *table;
|
||||
ForeignServer *server;
|
||||
List *options;
|
||||
ListCell *lc;
|
||||
|
||||
/* we use 1 by default, which means "no batching" */
|
||||
int batch_size = 1;
|
||||
int batch_size = 1;
|
||||
|
||||
/*
|
||||
* Load options for table and server. We append server options after
|
||||
* table options, because table options take precedence.
|
||||
* Load options for table and server. We append server options after table
|
||||
* options, because table options take precedence.
|
||||
*/
|
||||
table = GetForeignTable(foreigntableid);
|
||||
server = GetForeignServer(table->serverid);
|
||||
|
Reference in New Issue
Block a user