Re: Practical question.

From: louis gonzales <gonzales(at)linuxlouis(dot)net>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: Practical question.
Date: 2007-03-16 04:26:19
Message-ID: 45FA1C6B.1070503@linuxlouis.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hey Joshua,
I appreciate the insight. That's clear.

Thanks again,

Joshua D. Drake wrote:

>Tom Lane wrote:
>
>
>>louis gonzales <gonzales(at)linuxlouis(dot)net> writes:
>>
>>
>>>As an example:
>>>insertX which initiates the trigger reads the 'nextvalue' from the
>>>sequence and begins to create the associcated table
>>>insertY happens almost at the same time, so that it gets the same
>>>'nextvalue' from the sequence
>>>
>>>
>
>That won't happen because of isolation :). When InsertX increments the
>sequence, it is forever incremented, so when InsertY increments it gets
>the next value... e.g;
>
>CREATE TABLE foo(id serial);
>
>Transaction 1:
>BEGIN;
>INSERT INTO foo(id) VALUES (DEFAULT);
>id now == 1
>
>Transaction 2:
>BEGIN;
>INSERT INTO foo(id) VALUES (DEFAULT);
>id now == 2
>
>Transaction 1;
>COMMIT;
>
>Transaction 2;
>COMMIT;
>
>Even if Transaction 1 were to rollback, it has already incremented the
>sequence so the next transaction would get 3.
>
>Joshua D. Drake
>
>
>
>
>
>>[ blink... ] Whatever makes you think that could happen?
>>
>> regards, tom lane
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 5: don't forget to increase your free space map settings
>>
>>
>>
>
>
>
>

--
Email: louis(dot)gonzales(at)linuxlouis(dot)net
WebSite: http://www.linuxlouis.net
"Open the pod bay doors HAL!" -2001: A Space Odyssey
"Good morning starshine, the Earth says hello." -Willy Wonka

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Parthan SR 2007-03-16 04:52:23 Column does not exist when trying to insert data.
Previous Message Joshua D. Drake 2007-03-16 04:25:20 Re: Practical question.