diff options
Diffstat (limited to 'src/test/regress/expected')
| -rw-r--r-- | src/test/regress/expected/sequence.out | 63 | ||||
| -rw-r--r-- | src/test/regress/expected/truncate.out | 38 |
2 files changed, 94 insertions, 7 deletions
diff --git a/src/test/regress/expected/sequence.out b/src/test/regress/expected/sequence.out index 0576b575ee6..84ece98357b 100644 --- a/src/test/regress/expected/sequence.out +++ b/src/test/regress/expected/sequence.out @@ -99,9 +99,27 @@ DROP SEQUENCE sequence_test; CREATE SEQUENCE foo_seq; ALTER TABLE foo_seq RENAME TO foo_seq_new; SELECT * FROM foo_seq_new; - sequence_name | last_value | increment_by | max_value | min_value | cache_value | log_cnt | is_cycled | is_called ----------------+------------+--------------+---------------------+-----------+-------------+---------+-----------+----------- - foo_seq | 1 | 1 | 9223372036854775807 | 1 | 1 | 1 | f | f + sequence_name | last_value | start_value | increment_by | max_value | min_value | cache_value | log_cnt | is_cycled | is_called +---------------+------------+-------------+--------------+---------------------+-----------+-------------+---------+-----------+----------- + foo_seq | 1 | 1 | 1 | 9223372036854775807 | 1 | 1 | 1 | f | f +(1 row) + +SELECT nextval('foo_seq_new'); + nextval +--------- + 1 +(1 row) + +SELECT nextval('foo_seq_new'); + nextval +--------- + 2 +(1 row) + +SELECT * FROM foo_seq_new; + sequence_name | last_value | start_value | increment_by | max_value | min_value | cache_value | log_cnt | is_cycled | is_called +---------------+------------+-------------+--------------+---------------------+-----------+-------------+---------+-----------+----------- + foo_seq | 2 | 1 | 1 | 9223372036854775807 | 1 | 1 | 32 | f | t (1 row) DROP SEQUENCE foo_seq_new; @@ -155,18 +173,49 @@ SELECT nextval('sequence_test2'); 32 (1 row) -ALTER SEQUENCE sequence_test2 RESTART WITH 16 - INCREMENT BY 4 MAXVALUE 22 MINVALUE 5 CYCLE; +ALTER SEQUENCE sequence_test2 RESTART WITH 24 + INCREMENT BY 4 MAXVALUE 36 MINVALUE 5 CYCLE; +SELECT nextval('sequence_test2'); + nextval +--------- + 24 +(1 row) + SELECT nextval('sequence_test2'); nextval --------- - 16 + 28 +(1 row) + +SELECT nextval('sequence_test2'); + nextval +--------- + 32 +(1 row) + +SELECT nextval('sequence_test2'); + nextval +--------- + 36 +(1 row) + +SELECT nextval('sequence_test2'); + nextval +--------- + 5 +(1 row) + +ALTER SEQUENCE sequence_test2 RESTART; +SELECT nextval('sequence_test2'); + nextval +--------- + 32 (1 row) SELECT nextval('sequence_test2'); nextval --------- - 20 + 36 (1 row) SELECT nextval('sequence_test2'); diff --git a/src/test/regress/expected/truncate.out b/src/test/regress/expected/truncate.out index ed6182c69f9..929aba4da70 100644 --- a/src/test/regress/expected/truncate.out +++ b/src/test/regress/expected/truncate.out @@ -223,3 +223,41 @@ SELECT * FROM trunc_trigger_log; DROP TABLE trunc_trigger_test; DROP TABLE trunc_trigger_log; DROP FUNCTION trunctrigger(); +-- test TRUNCATE ... RESTART IDENTITY +CREATE SEQUENCE truncate_a_id1 START WITH 33; +CREATE TABLE truncate_a (id serial, + id1 integer default nextval('truncate_a_id1')); +NOTICE: CREATE TABLE will create implicit sequence "truncate_a_id_seq" for serial column "truncate_a.id" +ALTER SEQUENCE truncate_a_id1 OWNED BY truncate_a.id1; +INSERT INTO truncate_a DEFAULT VALUES; +INSERT INTO truncate_a DEFAULT VALUES; +SELECT * FROM truncate_a; + id | id1 +----+----- + 1 | 33 + 2 | 34 +(2 rows) + +TRUNCATE truncate_a; +INSERT INTO truncate_a DEFAULT VALUES; +INSERT INTO truncate_a DEFAULT VALUES; +SELECT * FROM truncate_a; + id | id1 +----+----- + 3 | 35 + 4 | 36 +(2 rows) + +TRUNCATE truncate_a RESTART IDENTITY; +INSERT INTO truncate_a DEFAULT VALUES; +INSERT INTO truncate_a DEFAULT VALUES; +SELECT * FROM truncate_a; + id | id1 +----+----- + 1 | 33 + 2 | 34 +(2 rows) + +DROP TABLE truncate_a; +SELECT nextval('truncate_a_id1'); -- fail, seq should have been dropped +ERROR: relation "truncate_a_id1" does not exist |
