Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2014

    Unanswered: Postgresql sequnce missing oftenly

    Dear all,
    I am using postgresql to store my data. In that i have sequnce to maintaing the order number. Sequnce working fine, but some time some sequnce missing, for eg, 00001...0006,0008....0099....0110,0112... so in this we missed 0007 & 0111. please help me to find out this problem also let me know how to fix this. your help will make good change in our system. thanks in advance.
    Please help me

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    usual causes of missing values in a sequence:-

    find out which of your users are starting to add rows and cancelling OR which of your users are deleting rows

    bear in mind the sequence / autonumber datatype should only be used to generate a value which makes that row unique. it should have no other meaning, and especially not outside the system. it is not appropriate to replace say an invoice, ticket GRN or other number that MUST (because of external business rules) be in a sequence.
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Nov 2003
    Provided Answers: 23
    Quote Originally Posted by rassan View Post
    so in this we missed 0007 & 0111
    No you are not. The value for a generated primary key has no (really: absolutely no) meaning whatsoever.
    A PK value of 42 is just as good as the value 9823649182 or 89354.

    The only purpose of such a value is to uniquely identify a single row in a table. It is completely irrelevant whether you have the values 1,2,3,4 or 345,798,3739,6593875 as values for your primary key.

    please help me to find out this problem also let me know how to fix this
    There is no problem and thus there is nothing to fix.
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags:

    Tips for good questions:

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts