Re[2]: Unexplained behaviour - Mailing list pgsql-general

From Jean-Christophe Boggio
Subject Re[2]: Unexplained behaviour
Date
Msg-id 19927283859.20010330165656@thefreecat.org
Whole thread Raw
In response to Re: Unexplained behaviour  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hi Tom,

Ref : Thursday, March 29, 2001 1:41:49 AM

TL> Your trigger will obviously fail to generate unique keys if two
TL> transactions are running concurrently, since any two transactions
TL> started in the same minute will generate the same initial key,
TL> and if they are running concurrently then neither will see the other's
TL> entry in the table.  Given that, I don't know why you're bothering.
TL> Why don't you use a sequence object to generate the unique keys?

I thought I could not do something like : a table with sequence with
before-insert-trigger that would define a field based on the
already-assigned-sequence number.

I tried, it works perfect and no more errors.

Again, again, again, many thanks.

TL> (The internal queries of the trigger will appear in the log only when
TL> compiled, ie, first time through that line in a particular backend.)

Did not know that. Precious information !

--
Jean-Christophe Boggio
cat@thefreecat.org
Independant Consultant and Developer
Delphi, Linux, Perl, PostgreSQL



pgsql-general by date:

Previous
From: Pluto
Date:
Subject: Data access permission?
Next
From: "Mitch Vincent"
Date:
Subject: Re: stability problems