Err, how is there a race condition? (Is there something I'm missing?)

>From my reasoning - every process running at a particular point in time
has a unique process ID (i.e. no two processes running at the same time
will have the same PID), therefore a time/date stamp coupled with a PID
gives a unique identifier. (For convenience and storage sake, a separate
primary key is used as well, but as that is created by the database
system itself, we don't know what that is at time of insertion.)

Even though I'm not using the two as a primary key, they combination of
the two are a valid key candidate. A identity field isn't required for
the sake of having one. Some tables have a primary key consisting of the
whole row. (Eg. a table that provides a many to many relationship
between two other tables.)

However, I'm happy to be proven wrong - is there something I'm missing
here?

Regards,

 
Michael S. E. Kraus
Software Developer/Technical Support Specialist
Wild Technology Pty Ltd
[EMAIL PROTECTED]
Direct Line 02-8306-0007 
________________________________

ABN 98 091 470 692
Level 4 Tiara, 306/9 Crystal Street, Waterloo NSW 2017, Australia
Telephone 1300-13-9453 |  Facsimile 1300-88-9453
http://www.wildtechnology.net

 

The information contained in this email message and any attachments may
be confidential information and may also be the subject of client legal
- legal professional privilege. If you are not the intended recipient,
any use, interference with, disclosure or copying of this material is
unauthorised and prohibited.   This email and any attachments are also
subject to copyright.  No part of them may be reproduced, adapted or
transmitted without the written permission of the copyright owner.  If
you have received this email in error, please immediately advise the
sender by return email and delete the message from your system.


-----Original Message-----
From: Robert Collins [mailto:[EMAIL PROTECTED] 
Sent: Monday, 18 October 2004 12:03 PM
To: Michael Kraus
Cc: Glen Turner; [EMAIL PROTECTED]
Subject: RE: [SLUG] Maximum process ID

On Mon, 2004-10-18 at 11:57 +1000, Michael Kraus wrote:
> G'day again... 
> 
> Actually, I want the PID for neither of the reasons you've said. 
> Rather, I'm using the PID and the date/time as a unique identifier to 
> a database row. The main contents of the row could occur more than 
> once in the table I'm working with - however we want to link this 
> exact row with rows in other tables in the database. Initially I 
> thought about using the date/time as an identifier (which I was 
> storing anyway), but remembered that two instances of the script could

> be running concurrently, so decided to incorporate the PID to ensure
uniqueness.

Theres still a race condition there. If you want a unique id, use a
unique id - an identity field for instance.

Rob

--
GPG key available at: <http://www.robertcollins.net/keys.txt>.
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to