Subject Re: [firebird-support] Computed column for primary key
Author Ann Harrison
On Thu, Jun 9, 2011 at 8:23 AM, Gordon Niessen <gordon@...> wrote:
> On 6/9/2011 3:29 AM, Alan J Davies wrote:
>> If every record has this character "-", it becomes meaningless in an
>> index. All you need is this:
> This might not be true in all cases.  Take for example the following
> data set:
> DEPT_ID    BUILD_ID  ACCOUNT_NBR
> 1                1                1-1
> 1                21              1-21
> 12              1                12-1
>
> Separators can be important.

Yes, and that's true of lots of compound keys. Firebird includes
extra characters in the generated key to distinguish between those
cases. It won't confuse department 1, building 21 with department
12, building 1. The algorithm inflates the size of generated keys
somewhat, but allows Firebird to omit trailing spaces in character
fields.

Good luck,

Ann