Skip to content
Snippets Groups Projects
Commit c8226429 authored by Tom Lane's avatar Tom Lane
Browse files

Add some basic tests of GUC behavior.

Joachim Wieland
parent 7946f772
No related branches found
No related tags found
No related merge requests found
-- 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)
# ----------
# 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
......
# $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
-- 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;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment