Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8524951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:50:03+00:00 2026-06-11T07:50:03+00:00

I have a problem on postgresql which I think there is a bug in

  • 0

I have a problem on postgresql which I think there is a bug in the postgresql, I wrongly implement something.

There is a table including colmn1(primary key), colmn2(unique), colmn3, …

After an insertion of a row, if I try another insertion with an existing colmn2 value I am getting a duplicate value error as I expected. But after this unsuccesful try, colmn1‘s next value is
incremented by 1 although there is no insertion so i am getting rows with id sequences like , 1,2,4,6,9.(3,5,6,7,8 goes for unsuccessful trials).

I need help from the ones who can explain this weird behaviour.

This information may be useful: I used “create unique index on tableName (lower(column1)) ” query to set unique constraint.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T07:50:05+00:00Added an answer on June 11, 2026 at 7:50 am

    See the PostgreSQL sequence FAQ:

    Sequences are intended for generating unique identifiers — not
    necessarily identifiers that are strictly sequential. If two
    concurrent database clients both attempt to get a value from a
    sequence (using nextval()), each client will get a different sequence
    value. If one of those clients subsequently aborts their transaction,
    the sequence value that was generated for that client will be unused,
    creating a gap in the sequence.

    This can’t easily be fixed without incurring a significant performance
    penalty. For more information, see Elein Mustein’s “Gapless Sequences for Primary Keys” in the General Bits Newsletter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Into : Currently i have scraped all the data into one PostgreSQL 'Bigtable' table(there
I have a dump of several Postgresql Tables in a selfcontained CSV file which
This is a problem (or design pattern?) which I would think is pretty common,
I have an PostgreSQL Function which returns me an XML where the whole infos
I have a table in a DB (Postgres based), which acts like a superclass
I am trying to solve an interesting problem. I have a table that has,
I have spent too much time on this problem and am beginning to think
I have a problem using Hibernate and PostgreSQL for production and HSQLDB for testing.
Facts Database: PostgreSQL (latest) Programming language: Java Problem statement (simplified) We have 2 tables
I have a throughput problem with DELETE/INSERT sequences on PostgreSQL 9.0. I am looking

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.