git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7946f77)
Add some basic tests of GUC behavior.
Fri, 4 Aug 2006 00:00:14 +0000 (00:00 +0000)
Fri, 4 Aug 2006 00:00:14 +0000 (00:00 +0000)
Joachim Wieland

src/test/regress/expected/guc.out [new file with mode: 0644] patch | blob
src/test/regress/sql/guc.sql [new file with mode: 0644] patch | blob

diff --git a/src/test/regress/expected/guc.out b/src/test/regress/expected/guc.out
new file mode 100644 (file)
index 0000000..fb6d0d7
--- /dev/null
+++ b/src/test/regress/expected/guc.out
@@ -0,0 +1,150 @@
+-- SET vacuum_cost_delay to some value
+SET vacuum_cost_delay TO 400;
+SHOW vacuum_cost_delay;
+ vacuum_cost_delay
+-------------------
+ 400ms
+(1 row)
+
+-- SET LOCAL has no effect outside of a transaction
+SET LOCAL vacuum_cost_delay TO 500;
+SHOW vacuum_cost_delay;
+ vacuum_cost_delay
+-------------------
+ 400ms
+(1 row)
+
+-- SET LOCAL within a transaction that commits
+BEGIN;
+SET LOCAL vacuum_cost_delay TO 500;
+SHOW vacuum_cost_delay;
+ vacuum_cost_delay
+-------------------
+ 500ms
+(1 row)
+
+COMMIT;
+SHOW vacuum_cost_delay;
+ vacuum_cost_delay
+-------------------
+ 400ms
+(1 row)
+
+-- SET should be reverted after ROLLBACK
+BEGIN;
+SET vacuum_cost_delay TO 600;
+SHOW vacuum_cost_delay;
+ vacuum_cost_delay
+-------------------
+ 600ms
+(1 row)
+
+ROLLBACK;
+SHOW vacuum_cost_delay;
+ vacuum_cost_delay
+-------------------
+ 400ms
+(1 row)
+
+-- Some tests with subtransactions
+BEGIN;
+SET vacuum_cost_delay TO 700;
+SAVEPOINT first_sp;
+SET vacuum_cost_delay TO 800;
+ROLLBACK TO first_sp;
+SHOW vacuum_cost_delay;
+ vacuum_cost_delay
+-------------------
+ 700ms
+(1 row)
+
+SAVEPOINT second_sp;
+SET vacuum_cost_delay TO 900;
+SAVEPOINT third_sp;
+SET vacuum_cost_delay TO 1000;
+SHOW vacuum_cost_delay;
+ vacuum_cost_delay
+-------------------
+ 1s
+(1 row)
+
+ROLLBACK TO third_sp;
+SHOW vacuum_cost_delay;
+ vacuum_cost_delay
+-------------------
+ 900ms
+(1 row)
+
+ROLLBACK TO second_sp;
+SHOW vacuum_cost_delay;
+ vacuum_cost_delay
+-------------------
+ 700ms
+(1 row)
+
+ROLLBACK;
+-- SET LOCAL with Savepoints
+BEGIN;
+SHOW vacuum_cost_delay;
+ vacuum_cost_delay
+-------------------
+ 400ms
+(1 row)
+
+SAVEPOINT sp;
+SET LOCAL vacuum_cost_delay TO 300;
+SHOW vacuum_cost_delay;
+ vacuum_cost_delay
+-------------------
+ 300ms
+(1 row)
+
+ROLLBACK TO sp;
+SHOW vacuum_cost_delay;
+ vacuum_cost_delay
+-------------------
+ 400ms
+(1 row)
+
+ROLLBACK;
+-- SET followed by SET LOCAL
+BEGIN;
+SET vacuum_cost_delay TO 400;
+SET LOCAL vacuum_cost_delay TO 500;
+SHOW vacuum_cost_delay;
+ vacuum_cost_delay
+-------------------
+ 500ms
+(1 row)
+
+COMMIT;
+SHOW vacuum_cost_delay;
+ vacuum_cost_delay
+-------------------
+ 400ms
+(1 row)
+
+--
+-- Test RESET. We use datestyle because the reset value is forced by
+-- pg_regress, so it doesn't depend on the installation's configuration.
+--
+SHOW datestyle;
+ DateStyle
+---------------
+ Postgres, MDY
+(1 row)
+
+SET datestyle = iso, ymd;
+SHOW datestyle;
+ DateStyle
+-----------
+ ISO, YMD
+(1 row)
+
+RESET datestyle;
+SHOW datestyle;
+ DateStyle
+---------------
+ Postgres, MDY
+(1 row)
+
diff --git a/src/test/regress/parallel_schedule b/src/test/regress/parallel_schedule
index 85a1bbe9f34a5495bd2d70b80bd1523aceb5c873..83f556a5a258a43cf60e2e38136395c7f9ee775b 100644 (file)
--- a/src/test/regress/parallel_schedule
+++ b/src/test/regress/parallel_schedule
@@ -1,6 +1,6 @@
# ----------
# The first group of parallel test
-# $PostgreSQL: pgsql/src/test/regress/parallel_schedule,v 1.32 2006年03月11日 04:38:41 momjian Exp $
+# $PostgreSQL: pgsql/src/test/regress/parallel_schedule,v 1.33 2006年08月04日 00:00:13 tgl Exp $
# ----------
test: boolean char name varchar text int2 int4 int8 oid float4 float8 bit numeric
@@ -69,7 +69,7 @@ test: misc
# ----------
# The fifth group of parallel test
# ----------
-test: select_views portals_p2 rules foreign_key cluster dependency
+test: select_views portals_p2 rules foreign_key cluster dependency guc
# ----------
# The sixth group of parallel test
diff --git a/src/test/regress/serial_schedule b/src/test/regress/serial_schedule
index 3342dc2ba1fe03c4336333609b9c78cbcaa94001..ec051c04551f20e7980309e35928400bcbb1cbd2 100644 (file)
--- a/src/test/regress/serial_schedule
+++ b/src/test/regress/serial_schedule
@@ -1,4 +1,4 @@
-# $PostgreSQL: pgsql/src/test/regress/serial_schedule,v 1.30 2006年01月22日 05:20:34 neilc Exp $
+# $PostgreSQL: pgsql/src/test/regress/serial_schedule,v 1.31 2006年08月04日 00:00:13 tgl Exp $
# This should probably be in an order similar to parallel_schedule.
test: boolean
test: char
@@ -84,6 +84,8 @@ test: portals_p2
test: rules
test: foreign_key
test: cluster
+test: dependency
+test: guc
test: limit
test: plpgsql
test: copy2
@@ -100,4 +102,3 @@ test: polymorphism
test: rowtypes
test: stats
test: tablespace
-test: dependency
diff --git a/src/test/regress/sql/guc.sql b/src/test/regress/sql/guc.sql
new file mode 100644 (file)
index 0000000..420f3f4
--- /dev/null
+++ b/src/test/regress/sql/guc.sql
@@ -0,0 +1,67 @@
+-- SET vacuum_cost_delay to some value
+SET vacuum_cost_delay TO 400;
+SHOW vacuum_cost_delay;
+
+-- SET LOCAL has no effect outside of a transaction
+SET LOCAL vacuum_cost_delay TO 500;
+SHOW vacuum_cost_delay;
+
+-- SET LOCAL within a transaction that commits
+BEGIN;
+SET LOCAL vacuum_cost_delay TO 500;
+SHOW vacuum_cost_delay;
+COMMIT;
+SHOW vacuum_cost_delay;
+
+-- SET should be reverted after ROLLBACK
+BEGIN;
+SET vacuum_cost_delay TO 600;
+SHOW vacuum_cost_delay;
+ROLLBACK;
+SHOW vacuum_cost_delay;
+
+-- Some tests with subtransactions
+BEGIN;
+SET vacuum_cost_delay TO 700;
+SAVEPOINT first_sp;
+SET vacuum_cost_delay TO 800;
+ROLLBACK TO first_sp;
+SHOW vacuum_cost_delay;
+SAVEPOINT second_sp;
+SET vacuum_cost_delay TO 900;
+SAVEPOINT third_sp;
+SET vacuum_cost_delay TO 1000;
+SHOW vacuum_cost_delay;
+ROLLBACK TO third_sp;
+SHOW vacuum_cost_delay;
+ROLLBACK TO second_sp;
+SHOW vacuum_cost_delay;
+ROLLBACK;
+
+-- SET LOCAL with Savepoints
+BEGIN;
+SHOW vacuum_cost_delay;
+SAVEPOINT sp;
+SET LOCAL vacuum_cost_delay TO 300;
+SHOW vacuum_cost_delay;
+ROLLBACK TO sp;
+SHOW vacuum_cost_delay;
+ROLLBACK;
+
+-- SET followed by SET LOCAL
+BEGIN;
+SET vacuum_cost_delay TO 400;
+SET LOCAL vacuum_cost_delay TO 500;
+SHOW vacuum_cost_delay;
+COMMIT;
+SHOW vacuum_cost_delay;
+
+--
+-- Test RESET. We use datestyle because the reset value is forced by
+-- pg_regress, so it doesn't depend on the installation's configuration.
+--
+SHOW datestyle;
+SET datestyle = iso, ymd;
+SHOW datestyle;
+RESET datestyle;
+SHOW datestyle;
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /