pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jan Wieck <JanWieck@Yahoo.com>
To: postgresql <pgsql@symcom.com>
Cc: Jan Wieck <JanWieck@Yahoo.com>
Cc: PgSQL-SQL <pgsql-sql@postgresql.org>
Subject: Re: creating "job numbers"
Date: Fri, 23 Mar 2001 13:09:49 -0500 (EST)
Message-ID: <200103231809.NAA18725@jupiter.jw.home> (raw)
In-Reply-To: <200103231747.MAA18525@jupiter.jw.home>

postgresql wrote:
> Jan,
>
> Thanks, I must be missing something here. Bear with me, I am
> trying to form an intelligent question.
>
> Using the serial data type... I don't understand when the backend
> would skip a number.
> If the db is assigning the number with the insert, then if two (or
> more) clients are trying to insert into the db at the exact same time,
> only those that are successful should get a number. I am trying to
> envision a situation where two clients hit at the same time and
> because of problem with the insert, one aborts and the serial data
> number is skipped. I would have assumed that the aborted insert is
> just skipped no harm done.

    Concurrency  will  not cause your transactions to abort. It's
    just if you do

        BEGIN;
        INSERT INTO ...
        ROLLBACK;

    that the generated sequence numbers don't get rolled back. So
    you might find job numbers 1, 2, 4 where 3 is missing because
    it's transaction aborted (explicit rollback or  error  during
    processing).  The  serial  data type will never fill in those
    gaps.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




view thread (9+ messages)

Message-ID: <200103231809.NAA18725@jupiter.jw.home>
Permalink:  ../200103231809.NAA18725@jupiter.jw.home/
Also on:    postgresql.org/message-id/200103231809.NAA18725@jupiter.jw.home

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: JanWieck@Yahoo.com, pgsql@symcom.com
  Subject: Re: creating "job numbers"
  In-Reply-To: <200103231809.NAA18725@jupiter.jw.home>
  References: <200103231747.MAA18525@jupiter.jw.home> <200103231809.NAA18725@jupiter.jw.home>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox