Re: [SQL] Random Unique Id

2009-10-20 Thread Craig Ringer
Nahuel Alejandro Ramos wrote: > Hi all, > I was searching for a sequence (for serials) that let me use a random > unique number ID on a Primary Key or a simple index. > I have not found a solution so I have done it by myself. I would like to > share it so here it is: Here's what I'm using: ht

Re: [SQL] Random Unique Id

2009-10-20 Thread Ivan Sergio Borgonovo
On Tue, 20 Oct 2009 16:49:17 -0300 Nahuel Alejandro Ramos wrote: > Hi all, > I was searching for a sequence (for serials) that let me use a > random unique number ID on a Primary Key or a simple index. > I have not found a solution so I have done it by myself. I would > like to share it so he

Re: [SQL] Random Unique Id

2009-10-20 Thread Nahuel Alejandro Ramos
:D, Yeah, i know. Its only an example. We are using this algorithm to give a random unique Id to our clients. The need was to give a PK absolute independent of time. Thanks to Ivan, for the pseudo-random posted, I am looking it. Regards... Nahuel Alejandro Ramos. On Tue, Oct 20, 2009 at 5:0

Re: [SQL] Random Unique Id

2009-10-20 Thread Rob Sargent
Suit yourself, of course, but the numbers on my credit cards are far, far from random :) Nahuel Alejandro Ramos wrote: > Yes. I looked this solution but it is not a "only numbers" ID. I would > like a random unique "number" Id. For example: generate a credit number > randomly (like the example I

Re: [SQL] Random Unique Id

2009-10-20 Thread Nahuel Alejandro Ramos
Yes. I looked this solution but it is not a "only numbers" ID. I would like a random unique "number" Id. For example: generate a credit number randomly (like the example I post). I used to insert an MD5 field but this time I need "only numbers" Id. Regards... Nahuel Alejandro Ramos. On Tue

Re: [SQL] Random Unique Id

2009-10-20 Thread Rob Sargent
Nahuel Alejandro Ramos wrote: > Hi all, > I was searching for a sequence (for serials) that let me use a random > unique number ID on a Primary Key or a simple index. > I have not found a solution so I have done it by myself. I would like > to share it so here it is: > > --

[SQL] Random Unique Id

2009-10-20 Thread Nahuel Alejandro Ramos
Hi all, I was searching for a sequence (for serials) that let me use a random unique number ID on a Primary Key or a simple index. I have not found a solution so I have done it by myself. I would like to share it so here it is: -- -- Create language "plpgsql" -- --