Re: 1 Sequence per Row i.e. each customer's first order starts at 1

From: Merrick <merrick(at)gmail(dot)com>
To: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: 1 Sequence per Row i.e. each customer's first order starts at 1
Date: 2009-07-02 03:11:24
Message-ID: b1972c6a0907012011s11e7b675r97420c66e756869f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thank you, this helps get me on the right path.

On Wed, Jul 1, 2009 at 7:12 PM, Scott Marlowe<scott(dot)marlowe(at)gmail(dot)com> wrote:
> On Wed, Jul 1, 2009 at 7:46 PM, Merrick<merrick(at)gmail(dot)com> wrote:
>> I was hoping there would be a way to add a field the sequence table
>> postgresql automatically generates so I could rely on whatever
>> mechanism postgresql uses to avoid the problems described thus far.
>>
>> I should have included more info, it's highly likely that multiple
>> users will be accessing using same customer_id when creating orders
>> thus deadlocks would be an issue I would like to avoid.
>>
>> Having the sequence be gapless would not be a requirement.
>
> Hmmm.  Well, are those users gonna be holding a lock while they do a
> lot of hand processing work?  Do they need that id before they start a
> lot of complex work?  In that case, you could do things two fold.
> Lock the rows, create an empty but ready to go one, commit, then come
> back later and update the row.
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scara Maccai 2009-07-02 05:57:19 R: Does anyone know of a job scheduler that uses PostgreSQL?
Previous Message Scott Marlowe 2009-07-02 02:12:04 Re: 1 Sequence per Row i.e. each customer's first order starts at 1