Thanks for that link Depesz!
It worked, I've run ALTER TABLE with your function and didn't have collisions.
I guess it's more bulletproof because random() is called not once, but
for every character therefore reducing possibility of collision by
multitude of number of bytes in hash.
CREATE OR REPL
On 29/01/2010 4:20 PM, Joe Kramer wrote:
Hello,
I need to generate unique id which is not guessable unlike
serial(integer) type. I need an id in format like md5 hash of random
number.
On top of that I need this id to be unique across multiple tables.
Anyone had to solve this problem before? Can
On Fri, 29 Jan 2010 13:13:17 +0100
"Wappler, Robert" wrote:
> I'd suggest to use some kind of sequence or something constructed
> from the primary keys. But you may still see hash collisions
> although the input is different.
Concatenate /* ::text */ random() with something like:
http://www.web
On 2010-01-29, Joe Kramer wrote:
> Thanks for the answer,
>
> I am unable to use ossp_uuid due to package install and/or server
> rebuild requirement.
>
> So I am trying to roll my own, and
> digest(quote_literal(random()+random()), 'sha256'), 'hex') doesn't
work:
>
Your input value is a rand
On Friday 29 January 2010 12.51:20 Joe Kramer wrote:
> So this means random()+random() is not random even within 2,000,000
> iterations!
>
Exactly the issue I wrote about: random() apparently doesn't deliver enough
randomness.
Even if it did: quote_literal(random() + random()) is ca. 14 to 16
Thanks for the answer,
I am unable to use ossp_uuid due to package install and/or server
rebuild requirement.
So I am trying to roll my own, and
digest(quote_literal(random()+random()), 'sha256'), 'hex') doesn't
work:
I have created this table and inserted 20 rows (two million).
This is more
On Fri, Jan 29, 2010 at 07:20:33PM +1100, Joe Kramer wrote:
> I need to generate unique id which is not guessable unlike
> serial(integer) type. I need an id in format like md5 hash of random
> number.
check this blogpost:
http://www.depesz.com/index.php/2007/06/25/random-text-record-identifiers/
On Friday 29 January 2010 11.21:00 Joe Kramer wrote:
> We have bunch of servers running the app and rebuilding postgres with
> support for ossp_uuid on all servers is time consuming.
> Is there a way of doing it without third party dependency like
> ossp_uuid? Should I just run md5(random number),
We have bunch of servers running the app and rebuilding postgres with
support for ossp_uuid on all servers is time consuming.
Is there a way of doing it without third party dependency like
ossp_uuid? Should I just run md5(random number), will itbe the same ?.
According to description it seems that
On Fri, Jan 29, 2010 at 10:31, Adrian von Bidder wrote:
>
> Hi,
>
> On Friday 29 January 2010 09.20:33 Joe Kramer wrote:
>> I need to generate unique id which is not guessable unlike
>> serial(integer) type. I need an id in format like md5 hash of random
>> number.
>> On top of that I need this id
Hi,
On Friday 29 January 2010 09.20:33 Joe Kramer wrote:
> I need to generate unique id which is not guessable unlike
> serial(integer) type. I need an id in format like md5 hash of random
> number.
> On top of that I need this id to be unique across multiple tables.
Have a look at http://www.po
Hello,
I need to generate unique id which is not guessable unlike
serial(integer) type. I need an id in format like md5 hash of random
number.
On top of that I need this id to be unique across multiple tables.
Anyone had to solve this problem before? Can you post any recipes or
best practices ple
12 matches
Mail list logo