}
/*
- * If the FSM knows nothing of the rel, try the last page before we
- * give up and extend. This avoids one-tuple-per-page syndrome during
+ * If the FSM knows nothing of the rel, try the last page before we give
+ * up and extend. This avoids one-tuple-per-page syndrome during
* bootstrapping or in a recently-started system.
*/
if (targetBlock == InvalidBlockNumber)
# Copy the type data from pg_type, and add some type-dependent items
my $type = $types{$atttype};
- $row->{atttypid} = $type->{oid};
- $row->{attlen} = $type->{typlen};
- $row->{attbyval} = $type->{typbyval};
- $row->{attalign} = $type->{typalign};
- $row->{attstorage} = $type->{typstorage};
+ $row->{atttypid} = $type->{oid};
+ $row->{attlen} = $type->{typlen};
+ $row->{attbyval} = $type->{typbyval};
+ $row->{attalign} = $type->{typalign};
+ $row->{attstorage} = $type->{typstorage};
$row->{attcompression} = '\0';
# set attndims if it's an array type
valuesAtt[Anum_pg_attribute_atthasdef - 1] = true;
replacesAtt[Anum_pg_attribute_atthasdef - 1] = true;
- if (rel->rd_rel->relkind == RELKIND_RELATION && add_column_mode &&
+ if (rel->rd_rel->relkind == RELKIND_RELATION && add_column_mode &&
!attgenerated)
{
expr2 = expression_planner(expr2);
}
/*
- * Initialize the batch slots. We don't know how many slots will be
- * needed, so we initialize them as the batch grows, and we keep
- * them across batches. To mitigate an inefficiency in how resource
- * owner handles objects with many references (as with many slots
- * all referencing the same tuple descriptor) we copy the tuple
- * descriptor for each slot.
+ * Initialize the batch slots. We don't know how many slots will
+ * be needed, so we initialize them as the batch grows, and we
+ * keep them across batches. To mitigate an inefficiency in how
+ * resource owner handles objects with many references (as with
+ * many slots all referencing the same tuple descriptor) we copy
+ * the tuple descriptor for each slot.
*/
if (resultRelInfo->ri_NumSlots >= resultRelInfo->ri_NumSlotsInitialized)
{
- TupleDesc tdesc = CreateTupleDescCopy(slot->tts_tupleDescriptor);
+ TupleDesc tdesc = CreateTupleDescCopy(slot->tts_tupleDescriptor);
resultRelInfo->ri_Slots[resultRelInfo->ri_NumSlots] =
MakeSingleTupleTableSlot(tdesc, slot->tts_ops);
*/
for (i = 0; i < node->mt_nrels; i++)
{
- int j;
+ int j;
ResultRelInfo *resultRelInfo = node->resultRelInfo + i;
if (!resultRelInfo->ri_usesFdwDirectModify &&
resultRelInfo);
/*
- * Cleanup the initialized batch slots. This only matters for FDWs with
- * batching, but the other cases will have ri_NumSlotsInitialized == 0.
+ * Cleanup the initialized batch slots. This only matters for FDWs
+ * with batching, but the other cases will have ri_NumSlotsInitialized
+ * == 0.
*/
for (j = 0; j < resultRelInfo->ri_NumSlotsInitialized; j++)
{
change_done:
/*
- * If speculative insertion was confirmed, the record isn't
- * needed anymore.
+ * If speculative insertion was confirmed, the record
+ * isn't needed anymore.
*/
if (specinsert != NULL)
{
" ORDER BY a.attnum",
lrel->remoteid,
(walrcv_server_version(LogRepWorkerWalRcvConn) >= 120000 ?
- "AND a.attgenerated = ''" : ""),
+ "AND a.attgenerated = ''" : ""),
lrel->remoteid);
res = walrcv_exec(LogRepWorkerWalRcvConn, cmd.data,
lengthof(attrRow), attrRow);
entry->pubactions.pubinsert = entry->pubactions.pubupdate =
entry->pubactions.pubdelete = entry->pubactions.pubtruncate = false;
entry->publish_as_relid = InvalidOid;
- entry->map = NULL; /* will be set by maybe_send_schema() if needed */
+ entry->map = NULL; /* will be set by maybe_send_schema() if
+ * needed */
}
/* Validate the entry */
if (rel == NULL || rel->rd_rel->relisshared || RecoveryInProgress())
return horizons.shared_oldest_nonremovable;
else if (IsCatalogRelation(rel) ||
- RelationIsAccessibleInLogicalDecoding(rel))
+ RelationIsAccessibleInLogicalDecoding(rel))
return horizons.catalog_oldest_nonremovable;
else if (RELATION_IS_LOCAL(rel))
return horizons.temp_oldest_nonremovable;
],
[ 'gset alone', 1, [qr{gset must follow an SQL command}], q{\gset} ],
[
- 'gset no SQL', 1,
+ 'gset no SQL', 1,
[qr{gset must follow an SQL command}], q{\set i +1
\gset}
],
[qr{too many arguments}], q{SELECT 1 \gset a b}
],
[
- 'gset after gset', 1,
+ 'gset after gset', 1,
[qr{gset must follow an SQL command}], q{SELECT 1 AS i \gset
\gset}
],
my $contents_raw = slurp_file($log);
my @contents = split(/\n/, $contents_raw);
- my $clen = @contents;
+ my $clen = @contents;
ok( $min <= $clen && $clen <= $max,
"transaction count for $log ($clen)");
my $clen_match = grep(/$re/, @contents);
/* batch insert stuff */
int ri_NumSlots; /* number of slots in the array */
- int ri_NumSlotsInitialized; /* number of initialized slots */
+ int ri_NumSlotsInitialized; /* number of initialized slots */
int ri_BatchSize; /* max slots inserted in a single batch */
TupleTableSlot **ri_Slots; /* input tuples for batch insert */
TupleTableSlot **ri_PlanSlots;
} JumbleState;
/* Values for the compute_query_id GUC */
-typedef enum
+enum ComputeQueryIdType
{
COMPUTE_QUERY_ID_OFF,
COMPUTE_QUERY_ID_ON,
COMPUTE_QUERY_ID_AUTO
-} ComputeQueryIdType;
+};
/* GUC parameters */
extern int compute_query_id;
$expected = 't' unless defined($expected); # default value
my $cmd = [
- $self->installed_command('psql'),
- '-XAt', '-d', $self->connstr($dbname)
+ $self->installed_command('psql'), '-XAt',
+ '-d', $self->connstr($dbname)
];
my ($stdout, $stderr);
my $max_attempts = 180 * 10;
$node_standby2->start;
# Recovery is not yet paused.
-is($node_standby2->safe_psql('postgres',
- "SELECT pg_get_wal_replay_pause_state()"),
- 'not paused', 'pg_get_wal_replay_pause_state() reports not paused');
+is( $node_standby2->safe_psql(
+ 'postgres', "SELECT pg_get_wal_replay_pause_state()"),
+ 'not paused',
+ 'pg_get_wal_replay_pause_state() reports not paused');
# Request to pause recovery and wait until it's actually paused.
$node_standby2->safe_psql('postgres', "SELECT pg_wal_replay_pause()");
"INSERT INTO tab_int VALUES (generate_series(21,30))");
$node_standby2->poll_query_until('postgres',
"SELECT pg_get_wal_replay_pause_state() = 'paused'")
- or die "Timed out while waiting for recovery to be paused";
+ or die "Timed out while waiting for recovery to be paused";
# Even if new WAL records are streamed from the primary,
# recovery in the paused state doesn't replay them.
-my $receive_lsn = $node_standby2->safe_psql('postgres',
- "SELECT pg_last_wal_receive_lsn()");
-my $replay_lsn = $node_standby2->safe_psql('postgres',
- "SELECT pg_last_wal_replay_lsn()");
+my $receive_lsn =
+ $node_standby2->safe_psql('postgres', "SELECT pg_last_wal_receive_lsn()");
+my $replay_lsn =
+ $node_standby2->safe_psql('postgres', "SELECT pg_last_wal_replay_lsn()");
$node_primary->safe_psql('postgres',
"INSERT INTO tab_int VALUES (generate_series(31,40))");
$node_standby2->poll_query_until('postgres',
"SELECT '$receive_lsn'::pg_lsn < pg_last_wal_receive_lsn()")
- or die "Timed out while waiting for new WAL to be streamed";
-is($node_standby2->safe_psql('postgres',
- "SELECT pg_last_wal_replay_lsn()"),
- qq($replay_lsn), 'no WAL is replayed in the paused state');
+ or die "Timed out while waiting for new WAL to be streamed";
+is( $node_standby2->safe_psql('postgres', "SELECT pg_last_wal_replay_lsn()"),
+ qq($replay_lsn),
+ 'no WAL is replayed in the paused state');
# Request to resume recovery and wait until it's actually resumed.
$node_standby2->safe_psql('postgres', "SELECT pg_wal_replay_resume()");
$node_standby2->poll_query_until('postgres',
- "SELECT pg_get_wal_replay_pause_state() = 'not paused' AND pg_last_wal_replay_lsn() > '$replay_lsn'::pg_lsn")
- or die "Timed out while waiting for recovery to be resumed";
+ "SELECT pg_get_wal_replay_pause_state() = 'not paused' AND pg_last_wal_replay_lsn() > '$replay_lsn'::pg_lsn"
+) or die "Timed out while waiting for recovery to be resumed";
# Check that the paused state ends and promotion continues if a promotion
# is triggered while recovery is paused.
or die "Timed out while waiting for recovery to be paused";
$node_standby2->promote;
-$node_standby2->poll_query_until('postgres',
- "SELECT NOT pg_is_in_recovery()")
+$node_standby2->poll_query_until('postgres', "SELECT NOT pg_is_in_recovery()")
or die "Timed out while waiting for promotion to finish";
$perlbin =~ s!\\!/!g if $TestLib::windows_os;
my $archivedir_primary = $node_primary->archive_dir;
$archivedir_primary =~ s!\\!/!g if $TestLib::windows_os;
-$node_primary->append_conf('postgresql.conf', qq(
+$node_primary->append_conf(
+ 'postgresql.conf', qq(
archive_command = '"$perlbin" "$FindBin::RealBin/cp_history_files" "%p" "$archivedir_primary/%f"'
wal_keep_size=128MB
));
# Make sure that Msys perl doesn't complain about difficulty in setting locale
# when called from the archive_command.
-local $ENV{PERL_BADLANG}=0;
+local $ENV{PERL_BADLANG} = 0;
$node_primary->start;
# Take backup from primary
# Create streaming standby linking to primary
my $node_standby = get_new_node('standby');
-$node_standby->init_from_backup($node_primary, $backup_name,
- allows_streaming => 1, has_streaming => 1, has_archiving => 1);
+$node_standby->init_from_backup(
+ $node_primary, $backup_name,
+ allows_streaming => 1,
+ has_streaming => 1,
+ has_archiving => 1);
$node_standby->start;
# Take backup of standby, use -Xnone so that pg_wal is empty.
$node_cascade->init_from_backup($node_standby, $backup_name,
has_streaming => 1);
$node_cascade->enable_restoring($node_primary);
-$node_cascade->append_conf('postgresql.conf', qq(
+$node_cascade->append_conf(
+ 'postgresql.conf', qq(
recovery_target_timeline='latest'
));
$node_standby->promote;
# Wait for promotion to complete
-$node_standby->poll_query_until('postgres',
- "SELECT NOT pg_is_in_recovery();")
- or die "Timed out while waiting for promotion";
+$node_standby->poll_query_until('postgres', "SELECT NOT pg_is_in_recovery();")
+ or die "Timed out while waiting for promotion";
# Find next WAL segment to be archived
my $walfile_to_be_archived = $node_standby->safe_psql('postgres',
"ALTER TABLE tab_nothing REPLICA IDENTITY NOTHING");
# Replicate the changes without replica identity index
-$node_publisher->safe_psql('postgres', "CREATE TABLE tab_no_replidentity_index(c1 int)");
-$node_publisher->safe_psql('postgres', "CREATE INDEX idx_no_replidentity_index ON tab_no_replidentity_index(c1)");
+$node_publisher->safe_psql('postgres',
+ "CREATE TABLE tab_no_replidentity_index(c1 int)");
+$node_publisher->safe_psql('postgres',
+ "CREATE INDEX idx_no_replidentity_index ON tab_no_replidentity_index(c1)"
+);
# Setup structure on subscriber
$node_subscriber->safe_psql('postgres', "CREATE TABLE tab_notrep (a int)");
);
# replication of the table without replica identity index
-$node_subscriber->safe_psql('postgres', "CREATE TABLE tab_no_replidentity_index(c1 int)");
-$node_subscriber->safe_psql('postgres', "CREATE INDEX idx_no_replidentity_index ON tab_no_replidentity_index(c1)");
+$node_subscriber->safe_psql('postgres',
+ "CREATE TABLE tab_no_replidentity_index(c1 int)");
+$node_subscriber->safe_psql('postgres',
+ "CREATE INDEX idx_no_replidentity_index ON tab_no_replidentity_index(c1)"
+);
# Setup logical replication
my $publisher_connstr = $node_publisher->connstr . ' dbname=postgres';
"DELETE FROM tab_include WHERE a > 20");
$node_publisher->safe_psql('postgres', "UPDATE tab_include SET a = -a");
-$node_publisher->safe_psql('postgres', "INSERT INTO tab_no_replidentity_index VALUES(1)");
+$node_publisher->safe_psql('postgres',
+ "INSERT INTO tab_no_replidentity_index VALUES(1)");
$node_publisher->wait_for_catchup('tap_sub');
is($result, qq(20|-20|-1),
'check replicated changes with primary key index with included columns');
-is($node_subscriber->safe_psql('postgres', q(SELECT c1 FROM tab_no_replidentity_index)),
- 1, "value replicated to subscriber without replica identity index");
+is( $node_subscriber->safe_psql(
+ 'postgres', q(SELECT c1 FROM tab_no_replidentity_index)),
+ 1,
+ "value replicated to subscriber without replica identity index");
# insert some duplicate rows
$node_publisher->safe_psql('postgres',
# test that truncate works for logical replication when there are multiple
# subscriptions for a single table
-$node_publisher->safe_psql('postgres',
- "CREATE TABLE tab5 (a int)");
+$node_publisher->safe_psql('postgres', "CREATE TABLE tab5 (a int)");
-$node_subscriber->safe_psql('postgres',
- "CREATE TABLE tab5 (a int)");
+$node_subscriber->safe_psql('postgres', "CREATE TABLE tab5 (a int)");
$node_publisher->safe_psql('postgres',
"CREATE PUBLICATION pub5 FOR TABLE tab5");
$result = $node_subscriber->safe_psql('postgres',
"SELECT count(*), min(a), max(a) FROM tab5");
-is($result, qq(0||),
- 'truncate replicated for multiple subscriptions');
+is($result, qq(0||), 'truncate replicated for multiple subscriptions');
# check deadlocks
$result = $node_subscriber->safe_psql('postgres',
# check that the map to convert tuples from leaf partition to the root
# table is correctly rebuilt when a new column is added
$node_publisher->safe_psql('postgres',
- "ALTER TABLE tab2 DROP b, ADD COLUMN c text DEFAULT 'pub_tab2', ADD b text");
+ "ALTER TABLE tab2 DROP b, ADD COLUMN c text DEFAULT 'pub_tab2', ADD b text"
+);
$node_publisher->safe_psql('postgres',
"INSERT INTO tab2 (a, b) VALUES (1, 'xxx'), (3, 'yyy'), (5, 'zzz')");
$node_publisher->safe_psql('postgres',
# Create publisher node
my $node_publisher = get_new_node('publisher');
$node_publisher->init(allows_streaming => 'logical');
-$node_publisher->append_conf('postgresql.conf',
- 'autovacuum = off');
+$node_publisher->append_conf('postgresql.conf', 'autovacuum = off');
$node_publisher->start;
# Create subscriber node
$node_subscriber->safe_psql('postgres', "ALTER SUBSCRIPTION tap_sub DISABLE");
# wait for the replication slot to become inactive in the publisher
-$node_publisher->poll_query_until('postgres',
- "SELECT COUNT(*) FROM pg_catalog.pg_replication_slots WHERE slot_name = 'tap_sub' AND active='f'", 1);
+$node_publisher->poll_query_until(
+ 'postgres',
+ "SELECT COUNT(*) FROM pg_catalog.pg_replication_slots WHERE slot_name = 'tap_sub' AND active='f'",
+ 1);
$node_publisher->safe_psql('postgres',
"SELECT pg_logical_emit_message(true, 'pgoutput', 'a transactional message')"
AppendPath
AppendRelInfo
AppendState
+ApplyExecutionData
ApplySubXactData
Archive
ArchiveEntryPtrType
IsForeignPathAsyncCapable_function
IsForeignRelUpdatable_function
IsForeignScanParallelSafe_function
+IsoConnInfo
IspellDict
Item
ItemId
PLpgSQL_stmt_return_next
PLpgSQL_stmt_return_query
PLpgSQL_stmt_rollback
-PLpgSQL_stmt_set
PLpgSQL_stmt_type
PLpgSQL_stmt_while
PLpgSQL_trigtype
Perl_check_t
Perl_ppaddr_t
Permutation
+PermutationStep
+PermutationStepBlocker
+PermutationStepBlockerType
PgArchData
PgBackendGSSStatus
PgBackendSSLStatus
SlabChunk
SlabContext
SlabSlot
-SlotAcquireBehavior
SlotErrCallbackArg
SlotNumber
SlruCtl
StatsElem
StatsExtInfo
StdAnalyzeData
+StdRdOptIndexCleanup
StdRdOptions
Step
StopList
VacAttrStats
VacAttrStatsP
VacErrPhase
-VacOptTernaryValue
+VacOptValue
VacuumParams
VacuumRelation
VacuumStmt