Skip site navigation (1) Skip section navigation (2)

Bug #699: pg_dump not reporting correct start value for sequence

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #699: pg_dump not reporting correct start value for sequence
Date: 2002-06-26 07:33:25
Message-ID: 20020626073325.8C4F2475C3D@postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
Martin Ellis (martin(at)myinternet(dot)com(dot)au) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
pg_dump not reporting correct start value for sequence

Long Description
It appears, when a sequence is incremented that value of start, as reported by pg_dump, seems to be set to 1.  I had expected to be set to the value set the 'create sequence' command regardless of the current sequence value.

How to reporduce:

sh: psql my_test
my_test=# create sequence my_test start 100;
CREATE
my_test=# select * from my_test;
 sequence_name | last_value | increment_by |      max_value      | min_value | cache_value | log_cnt | is_cycled | is_called
---------------+------------+--------------+---------------------+-----------+-------------+---------+-----------+-----------
 my_test       |        100 |            1 | 9223372036854775807 |         1 |           1 |       1 | f         | f

my_test=# \q
sh: pg_dump my_test
\\connect - martin

--
-- TOC Entry ID 20 (OID 17718)
--
-- Name: my_test Type: SEQUENCE Owner: martin
--

CREATE SEQUENCE "my_test" start 100 increment 1 maxvalue 9223372036854775807 minvalue 1 cache 1;

connect - martin

--
-- TOC Entry ID 21 (OID 17718)
--
-- Name: my_test Type: SEQUENCE SET Owner: martin
--

SELECT setval ('"my_test"', 100, false);

sh: psql my_test
my_test=# select nextval('my_test');
 nextval
---------
     100
(1 row)

my_test=#\q
sh: pg_dump my_test
\connect - martin

--
-- TOC Entry ID 20 (OID 17718)
--
-- Name: my_test Type: SEQUENCE Owner: martin
--

CREATE SEQUENCE "my_test" start 1 increment 1 maxvalue 9223372036854775807 minvalue 1 cache 1;

\connect - martin

--
-- TOC Entry ID 21 (OID 17718)
--
-- Name: my_test Type: SEQUENCE SET Owner: martin
--

SELECT setval ('"my_test"', 100, true);


-------------------

As you can see from the two dumps the although the value of the sequence remains correct, the start value does not.

This causes problems for me as I use the dump to check if the schema is up to date.

Martin Ellis

Sample Code


No file was uploaded with this report




Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2002-06-26 13:53:34
Subject: Re: Bug #699: pg_dump not reporting correct start value for sequence
Previous:From: Tatsuo IshiiDate: 2002-06-26 03:42:06
Subject: Re: Invalid EUC_TW character sequence found

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group