[development] Unique/Random IDs and drupal

Robert Douglass rob at robshouse.net
Mon Aug 11 12:49:39 UTC 2008

On Aug 11, 2008, at 2:38 PM, Earnie Boyd wrote:

> Quoting Robert Douglass <rob at robshouse.net>:
>> I could export my blog posts from one site and import them into   
>> another site and keep the id.
> You could "keep the id" but IMO you shouldn't.  You don't know if  
> there may be an existing id in the receiving DB.  The ID is unique  
> to each DB and existing values should not be merged from one DB into  
> another.  That said, the only correct method for merging data from  
> one DB into another is to use the API for the receiving DB so that  
> the foreign key constraints match appropriately (even for those DB  
> engines not supporting foreign key constraints).  In Drupal's case  
> the nid should be removed so that a new nid is created or the uid  
> should be removed so that a new uid is created.  An import/export  
> API should take into consideration this fact and allow for the  
> removal of the ID columns on import or export.
> Earnie -- http://for-my-kids.com/
> -- http://give-me-an-offer.com/

No, this is the entire point of Ethan's suggestion. The id's *are*  
globally (meaning universe-wide) unique. Note also that there is no  
inherent suggestion that one *wouldn't* use Drupal APIs. On the  
contrary, this discussion is about extending Drupal APIs (at least  
taking the first incremental step - moving to 64 bit integers). I  
really don't think you can satisfy the use cases discussed thus far  
easily with existing Drupal APIs.


"A Universally Unique Identifier (UUID) is an identifier standard used  
in software construction, standardized by the Open Software Foundation  
(OSF) as part of the Distributed Computing Environment (DCE). The  
intent of UUIDs is to enable distributed systems to uniquely identify  
information without significant central coordination. Thus, anyone can  
create a UUID and use it to identify something with reasonable  
confidence that the identifier will never be unintentionally used by  
anyone for anything else. Information labeled with UUIDs can therefore  
be later combined into a single database without needing to resolve  
name conflicts. The most widespread use of this standard is in  
Microsoft's Globally Unique Identifiers (GUIDs). Other significant  
users include Linux's ext2/ext3 filesystem, LUKS encrypted partitions,  
GNOME, KDE, and Mac OS X, all of which use implementations derived  
from the uuid library found in the e2fsprogs package."

More information about the development mailing list