Subject Re: [firebird-support] Varchar in PK
Author Helen Borrie
At 12:57 PM 29/11/2003 +0000, you wrote:
>Hi,
>
>Is there some issue against using a varchar column in primary key?

Varchar in PK, per se, no. It works, provided the index can accommodate it
(253 bytes or less: remember that character sets, collations and composite
indexes eat more..)

These limitations aside, mechanically, it works. So, if you have some way
of creating a unique, ATOMIC varchar value for your PK, then a varchar PK
is OK.

The deciding factor is ATOMICITY. Varchar columns are not typically
atomic. That is, they usually have some meaning as data. That usually
means humans will want to change them. To ensure data integrity, the
values in key columns should never be visible to user
applications; otherwise your database integrity is in the hands of the
worst typist in the organisation.

/heLen