Re: (psuedo) random serial for PK or at least UNIQUE NOT NULL?

From: Vincenzo Romano <vincenzo(dot)romano(at)notorand(dot)it>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: (psuedo) random serial for PK or at least UNIQUE NOT NULL?
Date: 2010-05-05 07:01:53
Message-ID: j2o3eff28921005050001pd025e691i66c3d7f107c180e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2010/5/4 Alvaro Herrera <alvherre(at)commandprompt(dot)com>:
> Vincenzo Romano wrote:
>> Hi all.
>>
>> I'm willing to change an BIGINT ID column (actually a SERIAL8) with a
>> BIGINT whose valules are (pseudo)random.
>> The main objective is to avoid guessability.
>> I whish I could also use it as the PK (as it's now) but that's not
>> really important now.
>> Any hint?
>
> http://wiki.postgresql.org/wiki/Pseudo_encrypt

That's a nice starting point.
I should apply that function twice for each 32-bit chunk of a
64-bit BIGINT and then merge the results into a single BIGINT ...
Boring but doable!

--
Vincenzo Romano
NotOrAnd Information Technologies
NON QVIETIS MARIBVS NAVTA PERITVS

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message raha sadeghi 2010-05-05 07:28:57 need help on postgres
Previous Message Konstantin Izmailov 2010-05-05 06:53:58 Re: Savepoint and prepared transactions