Search Postgresql Archives

Re: PostgreSQL Developer Best Practices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/25/2015 1:38 PM, Joshua D. Drake wrote:
But a VIN is in fact, UNIQUE so it is useful as a PK.

JD

But a VIN is *not* guaranteed to exist, nor is it guaranteed never to change, and I regard those as pretty important characteristics in a PK.

VINs were not required in the U.S. until 1954, and were not in a standardized format until 1981; other countries have different dates. If you are dealing with [or ever might deal with] pre-war classics, early imports, kit cars, or other out-of-the-mainstream vehicles, you have to deal with the possibility of a vehicle that doesn't have a traditional VIN, certainly not one in the 'expected' 17-character format. Changing VINs likewise are very very rare but not impossible (perhaps the most common instance would be something like an antique where they used the engine serial number as the VIN, only now it has had the engine replaced and the DMV insists it have a new number). A lot of "natural" PKs have similar oddities and corner cases that 99.99% of us will never encounter, but you don't want to be in the 0.01%. Artificial keys don't suffer these problems.

--christine desmuke


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux