[wp-hackers] Why URL in GUID?
ringmaster at midnightcircus.com
Tue Oct 3 00:53:33 GMT 2006
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.
More information about the wp-hackers