Re[2]: Unexplained behaviour

From: Jean-Christophe Boggio <cat(at)thefreecat(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: postgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re[2]: Unexplained behaviour
Date: 2001-03-30 14:56:56
Message-ID: 19927283859.20010330165656@thefreecat.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)thefreecat(dot)org
Independant Consultant and Developer
Delphi, Linux, Perl, PostgreSQL

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Lockhart 2001-03-30 15:04:25 Re: Call for platforms
Previous Message Peter Eisentraut 2001-03-30 14:56:50 Re: database dirs very stange on solaris