Postgresql information_schema.sequences shows wrong start_value

2.9k views Asked by At

Can anyone explain this to me:

This is my sequence:

CREATE SEQUENCE core.seqsynceodlogw   
  INCREMENT 10  
  MINVALUE 1
  MAXVALUE 9223372036854775807
  START 492604
  CACHE 1; 

ALTER TABLE core.seqsynceodlogw    OWNER TO acenter;

You can see that start value is 492604.

This is the information_schema query:

select * 
from information_schema.sequences 
where increment = '10' 
and sequence_schema = 'core' 
and sequence_name = 'seqsynceodlogw'

In the query result set says that start_value is 490691.

Does anyone know what value is this start_value in information_schema or why is different from one in the sequence?

1

There are 1 answers

1
Ashish sinha On

the code provided by yoy contains cache 1, its not possible to put it one.

CREATE SEQUENCE  "SYSTEM"."SEQSYNCEODLOGW"  
  MINVALUE 1 
  MAXVALUE 9223372036854775807 
  INCREMENT BY 10 
  START WITH 492604 
  CACHE 2 NOORDER  NOCYCLE

if you check the nextval as:

select SEQSYNCEODLOGW.nextval from dual;

then you can check the value 492604