[wp-hackers] Why URL in GUID?

Paul Menard codehooligans at codehooligans.com
Tue Oct 3 01:19:07 GMT 2006


Owen,

Thanks for clearing that up. I had no idea.

P-

On Oct 2, 2006, at 7:53 PM, Owen Winkler wrote:

> Paul Menard wrote:
>> The only I have is if this value must be unique, why is it not a  
>> unique key in the database. More specific, why is it not 'the'  
>> unique key?
>
> Because it's not the "ID" field, it's the "Globally Unique ID" field.
>
> That means the value stored in that field must be unique not just  
> for one site, but for any site anywhere.  The GUID is used, for one  
> example, to differentiate posts on different sites for feed  
> aggregators.
>
> Presumably, if you switched sites and also changed the URL in your  
> aggregator to the new setting, it would know not to re-load posts  
> with the old GUIDs because they haven't changed.  Unfortunately,  
> there is plenty of aggregator software that doesn't obey the spec,  
> and when they ignore this, it causes some issues.  But you can also  
> see why the GUID should not change when you change the slug.
>
> You can't use the ID field of the posts table as the GUID because  
> that value is *very* common among all blogs.  Creating hashes from  
> existing data is never going to produce a more globally unique ID  
> for a post than the actual URL for the post.
>
> Owen
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



More information about the wp-hackers mailing list