Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Postgres/contrib/pg_visibility/t/   (Postgres Database Version 18.4©)  Datei vom 11.4.2026 mit Größe 1 kB image not shown  

Quelle  001_concurrent_transaction.pl

  Sprache: Shell
 


# Copyright (c) 2021-2025, PostgreSQL Global Development Group

# Check that a concurrent transaction doesn't cause false negatives in
# pg_check_visible() function
use strict;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use Test::More;


# Initialize the primary node
my $node = PostgreSQL::Test::Cluster->new('main');
$node->init(allows_streaming => 1);
$node->start;

# Initialize the streaming standby
my $backup_name = 'my_backup';
$node->backup($backup_name);
my $standby = PostgreSQL::Test::Cluster->new('standby');
$standby->init_from_backup($node, $backup_name, has_streaming => 1);
$standby->start;

# Setup another database
$node->safe_psql("postgres""CREATE DATABASE other_database;\n");
my $bsession = $node->background_psql('other_database');

# Run a concurrent transaction
$bsession->query_safe(
 qq[
 BEGIN;
 SELECT txid_current();
]);

# Create a sample table and run vacuum
$node->safe_psql("postgres",
  "CREATE EXTENSION pg_visibility;\n"
   . "CREATE TABLE vacuum_test AS SELECT 42 i;\n"
   . "VACUUM (disable_page_skipping) vacuum_test;");

# Run pg_check_visible()
my $result = $node->safe_psql("postgres",
 "SELECT * FROM pg_check_visible('vacuum_test');");

# There should be no false negatives
ok($result eq """pg_check_visible() detects no errors");

# Run pg_check_visible() on standby
$node->wait_for_catchup($standby);
$result = $standby->safe_psql("postgres",
 "SELECT * FROM pg_check_visible('vacuum_test');");

# There should be no false negatives either
ok($result eq """pg_check_visible() detects no errors");

# Shutdown
$bsession->query_safe("COMMIT;");
$bsession->quit;
$node->stop;
$standby->stop;

done_testing();

Messung V0.5 in Prozent
C=80 H=100 G=90

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet am  2026-08-06) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.