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

Quelle  prepared.sql

  Sprache: SQL
 

-- predictability
SET synchronous_commit = on;
SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot''test_decoding');

CREATE TABLE test_prepared1(id int);
CREATE TABLE test_prepared2(id int);

-- test simple successful use of a prepared xact
BEGIN;
INSERT INTO test_prepared1 VALUES (1);
PREPARE TRANSACTION 'test_prepared#1';
COMMIT PREPARED 'test_prepared#1';
INSERT INTO test_prepared1 VALUES (2);

-- test abort of a prepared xact
BEGIN;
INSERT INTO test_prepared1 VALUES (3);
PREPARE TRANSACTION 'test_prepared#2';
ROLLBACK PREPARED 'test_prepared#2';

INSERT INTO test_prepared1 VALUES (4);

-- test prepared xact containing ddl
BEGIN;
INSERT INTO test_prepared1 VALUES (5);
ALTER TABLE test_prepared1 ADD COLUMN data text;
INSERT INTO test_prepared1 VALUES (6'frakbar');
PREPARE TRANSACTION 'test_prepared#3';

-- test that we decode correctly while an uncommitted prepared xact
-- with ddl exists.

-- separate table because of the lock from the ALTER
-- this will come before the '5' row above, as this commits before it.
INSERT INTO test_prepared2 VALUES (7);

COMMIT PREPARED 'test_prepared#3';

-- make sure stuff still works
INSERT INTO test_prepared1 VALUES (8);
INSERT INTO test_prepared2 VALUES (9);

-- cleanup
DROP TABLE test_prepared1;
DROP TABLE test_prepared2;

-- show results
SELECT data FROM pg_logical_slot_get_changes('regression_slot'NULLNULL'include-xids''0''skip-empty-xacts''1');

SELECT pg_drop_replication_slot('regression_slot');

Messung V0.5 in Prozent
C=91 H=97 G=93

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

*© 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.