Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Postgres/src/test/isolation/specs/   (Postgres Database Version 18.4©)  Datei vom 11.4.2026 mit Größe 962 B image not shown  

Quelle  partial-index.spec  Sprache: unbekannt

 
Spracherkennung für: .spec vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

# Partial Index test
#
# Make sure that an update which moves a row out of a partial index
# is handled correctly.  In early versions, an attempt at optimization
# broke this behavior, allowing anomalies.
#
# Any overlap between the transactions must cause a serialization failure.

setup
{
 create table test_t (id integer, val1 text, val2 integer);
 create index test_idx on test_t(id) where val2 = 1;
 insert into test_t (select generate_series(0, 10000), 'a', 2);
 insert into test_t (select generate_series(0, 10), 'a', 1);
}

teardown
{
 DROP TABLE test_t;
}

session s1
setup  { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step rxy1 { select * from test_t where val2 = 1; }
step wx1 { update test_t set val2 = 2 where val2 = 1 and id = 10; }
step c1  { COMMIT; }

session s2
setup  { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step wy2 { update test_t set val2 = 2 where val2 = 1 and id = 9; }
step rxy2 { select * from test_t where val2 = 1; }
step c2  { COMMIT; }

[Dauer der Verarbeitung: 0.14 Sekunden, vorverarbeitet 2026-09-28]