Visibility regression test

Поиск
Список
Период
Сортировка
От Manfred Koizar
Тема Visibility regression test
Дата
Msg-id un4smug9f1qd7ljdelrthidbdf200l7i62@4ax.com
обсуждение исходный текст
Ответы Re: Visibility regression test  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches
A new regression test trying to detect runaway INSERTs/UPDATEs.

Please add to CVS:
    src/test/regress/expected/visibility.out
    src/test/regress/sql/visibility.sql

Servus
 Manfred
diff -ruN ../base/src/test/regress/expected/visibility.out src/test/regress/expected/visibility.out
--- ../base/src/test/regress/expected/visibility.out    1970-01-01 01:00:00.000000000 +0100
+++ src/test/regress/expected/visibility.out    2002-08-29 14:05:17.000000000 +0200
@@ -0,0 +1,23 @@
+--
+-- VISIBILITY
+--
+-- Try to detect the so-called halloween problem, where a command
+-- sees its own modifications.  If this happens, the UPDATE/INSERT
+-- gets into an endless loop, which is eventually aborted due to
+-- statement_timeout.
+-- This test might fail on a *very* slow machine.
+CREATE TABLE vistst (i INT);
+SET statement_timeout = 10000;  -- 10 seconds
+BEGIN;
+INSERT INTO vistst VALUES (0);
+UPDATE vistst SET i = i + 1;
+INSERT INTO vistst SELECT i + 1 FROM vistst;
+COMMIT;
+SELECT * FROM vistst;
+ i
+---
+ 1
+ 2
+(2 rows)
+
+DROP TABLE vistst;
diff -ruN ../base/src/test/regress/parallel_schedule src/test/regress/parallel_schedule
--- ../base/src/test/regress/parallel_schedule    2002-07-20 17:27:23.000000000 +0200
+++ src/test/regress/parallel_schedule    2002-08-29 13:49:03.000000000 +0200
@@ -38,7 +38,7 @@
 # ----------
 # The third group of parallel test
 # ----------
-test: constraints triggers create_misc create_aggregate create_operator create_index inherit vacuum
+test: constraints triggers create_misc create_aggregate create_operator create_index inherit visibility vacuum

 # Depends on the above
 test: create_view
diff -ruN ../base/src/test/regress/serial_schedule src/test/regress/serial_schedule
--- ../base/src/test/regress/serial_schedule    2002-07-20 17:27:23.000000000 +0200
+++ src/test/regress/serial_schedule    2002-08-29 13:46:46.000000000 +0200
@@ -50,6 +50,7 @@
 test: create_operator
 test: create_index
 test: inherit
+test: visibility
 test: vacuum
 test: create_view
 test: sanity_check
diff -ruN ../base/src/test/regress/sql/visibility.sql src/test/regress/sql/visibility.sql
--- ../base/src/test/regress/sql/visibility.sql    1970-01-01 01:00:00.000000000 +0100
+++ src/test/regress/sql/visibility.sql    2002-08-29 13:45:25.000000000 +0200
@@ -0,0 +1,21 @@
+--
+-- VISIBILITY
+--
+-- Try to detect the so-called halloween problem, where a command
+-- sees its own modifications.  If this happens, the UPDATE/INSERT
+-- gets into an endless loop, which is eventually aborted due to
+-- statement_timeout.
+-- This test might fail on a *very* slow machine.
+
+CREATE TABLE vistst (i INT);
+SET statement_timeout = 10000;  -- 10 seconds
+
+BEGIN;
+INSERT INTO vistst VALUES (0);
+UPDATE vistst SET i = i + 1;
+INSERT INTO vistst SELECT i + 1 FROM vistst;
+COMMIT;
+
+SELECT * FROM vistst;
+
+DROP TABLE vistst;

В списке pgsql-patches по дате отправления:

Предыдущее
От: Serguei Mokhov
Дата:
Сообщение: Re: fix for palloc() of user-supplied length
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Visibility regression test