Re: PostgreSQL Developer Best Practices

From: Christine Desmuke <cdesmuke(at)kshs(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: PostgreSQL Developer Best Practices
Date: 2015-08-25 22:59:28
Message-ID: 55DCF350.70606@kshs.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Browse pgsql-general by date

  From Date Subject
Next Message Rob Sargent 2015-08-25 23:12:48 Re: PostgreSQL Developer Best Practices
Previous Message Neil Tiffin 2015-08-25 22:57:28 Re: PostgreSQL Developer Best Practices