Re: [GENERAL] all serial type was changed to 1 - Mailing list pgsql-general

From Max Wang
Subject Re: [GENERAL] all serial type was changed to 1
Date
Msg-id ME1PR01MB1394ED8DF7A0C635F327208AA8140@ME1PR01MB1394.ausprd01.prod.outlook.com
Whole thread Raw
In response to Re: [GENERAL] all serial type was changed to 1  (Adrian Klaver <adrian.klaver@aklaver.com>)
Responses Re: [GENERAL] all serial type was changed to 1
List pgsql-general
Hi Adrian,

I checked and found

is_cycled     | f

Regards,
Max

-----Original Message-----
From: Adrian Klaver [mailto:adrian.klaver@aklaver.com]
Sent: Tuesday, 2 May 2017 9:16 AM
To: Max Wang <mwang@1080agile.com>; pgsql-general@postgresql.org
Subject: Re: [GENERAL] all serial type was changed to 1

On 05/01/2017 04:08 PM, Max Wang wrote:
> Hi Adrian,
>
> Only sequences (id) reset to 1.

Then per Amitabh Kant's suggestion take a look at the cycle setting for the sequences.

For sequence named ts_stamp_test_id_seq:

test=# select * from ts_stamp_test_id_seq ; -[ RECORD 1 ]-+--------------------- sequence_name | ts_stamp_test_id_seq
last_value    | 6
start_value   | 1
increment_by  | 1
max_value     | 9223372036854775807
min_value     | 1
cache_value   | 1
log_cnt       | 0
is_cycled     | f
is_called     | t


You are looking for whether is_cycled = t

Per the docs:

https://www.postgresql.org/docs/9.6/static/sql-createsequence.html

"CYCLE
NO CYCLE

     The CYCLE option allows the sequence to wrap around when the maxvalue or minvalue has been reached by an ascending
ordescending sequence respectively. If the limit is reached, the next number generated will be the minvalue or
maxvalue,respectively. 

     If NO CYCLE is specified, any calls to nextval after the sequence has reached its maximum value will return an
error.If neither CYCLE or NO CYCLE are specified, NO CYCLE is the default. 
"

>
> Regards,
> Max
>



--
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: Igor Korot
Date:
Subject: Re: [GENERAL] Compatibility of libpg
Next
From: Adrian Klaver
Date:
Subject: Re: [GENERAL] all serial type was changed to 1