Обсуждение: Sequence Start number not dumped correctly

Поиск
Список
Период
Сортировка

Sequence Start number not dumped correctly

От
Reto Stamm
Дата:
Hi,

When I have a sequence like this:

CREATE SEQUENCE "test_id_seq" start -32768 increment 1 maxvalue 32767 minvalue
-32768 cache 1;

and dump it using

pg_dump -s -c -f schema.txt testdb

it will show up in schema.txt like this:

CREATE SEQUENCE "test_id_seq" start 1 increment 1 maxvalue 32767 minvalue -32768
cache 1;

This makes me think that the start value is hardwired somewhere, and I wanted to
let you know. PostgreSQL is great! I use it for everything!

Thanks a lot

--reto

Re: Sequence Start number not dumped correctly

От
Tom Lane
Дата:
Reto Stamm <reto@retostamm.com> writes:
> When I have a sequence like this:
> CREATE SEQUENCE "test_id_seq" start -32768 increment 1 maxvalue 32767 minvalue
> -32768 cache 1;

> it will show up in schema.txt like this:

> CREATE SEQUENCE "test_id_seq" start 1 increment 1 maxvalue 32767 minvalue -32768
> cache 1;

How old is your Postgres?  It works here.

But note that there is probably also a select setval() for the sequence,
which is what *really* determines the starting value.

            regards, tom lane

Re: Sequence Start number not dumped correctly

От
Reto Stamm
Дата:
Hello Tom,

I am sorry, I can not reproduce it any more either. I must have made a mistake.

It works perfectly (like the rest of Postgres). Thank you very much, I am sorry
for the waste of time.

Best regards

--reto

Quoting Tom Lane <tgl@sss.pgh.pa.us>:

> Reto Stamm <reto@retostamm.com> writes:
> > When I have a sequence like this:
> > CREATE SEQUENCE "test_id_seq" start -32768 increment 1 maxvalue 32767
> minvalue
> > -32768 cache 1;
>
> > it will show up in schema.txt like this:
>
> > CREATE SEQUENCE "test_id_seq" start 1 increment 1 maxvalue 32767 minvalue
> -32768
> > cache 1;
>
> How old is your Postgres?  It works here.
>
> But note that there is probably also a select setval() for the sequence,
> which is what *really* determines the starting value.
>
>             regards, tom lane