On Thu, Jul 2, 2009 at 10:35 AM, Scott Marlowe wrote:
> Actually, since
> you're only incrementing from the highest one, you could just lock the
> id from a select max(orderid) where custid=xyz and you'd only have to
> lock one row.
Not really because you would have a race condition between select
On Thu, Jul 2, 2009 at 3:28 AM, Greg Stark wrote:
>> On Wed, Jul 1, 2009 at 6:01 PM, Scott Marlowe wrote:
>>> The simplest method is to do something like:
>>>
>>> begin;
>>> select * from sometable where cust_id=99 order by order_id desc for update;
>>>
>>> to lock all the customer records for cust
On Thu, Jul 2, 2009 at 2:46 AM, Merrick 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.
Hm, well you could create a sequence for every
Thank you, this helps get me on the right path.
On Wed, Jul 1, 2009 at 7:12 PM, Scott Marlowe wrote:
> On Wed, Jul 1, 2009 at 7:46 PM, Merrick 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
>> mechanis
On Wed, Jul 1, 2009 at 7:46 PM, Merrick 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 high
I'm sure a trigger could be written to do what I just said.
On Wed, Jul 1, 2009 at 7:46 PM, Merrick 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 descri
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 sa
On Wed, Jul 1, 2009 at 6:04 PM, Merrick wrote:
> I have been using postgresql for 8 years in web projects and ran into
> a problem that I could not find a solution for in the archives or
> through Google.
>
> Here is a generalized example of what I want to happen. I have a
> customers table, and an
On Thu, Jul 2, 2009 at 1:04 AM, Merrick wrote:
> I would like for each customer
> to have orders that start at 1 and move up sequentially. I realize
> it's probably not efficient to create a new sequence for each
> customer, so am looking for alternate ways to accomplish the same
> thing.
You coul
I have been using postgresql for 8 years in web projects and ran into
a problem that I could not find a solution for in the archives or
through Google.
Here is a generalized example of what I want to happen. I have a
customers table, and an orders table. I would like for each customer
to have orde
10 matches
Mail list logo