I have a web application that is used to create web surveys and web forms. Users can create any number of surveys or forms at any time. The primary key on one of my tables defines the ID for any given form or survey. I do NOT want the number sequential. Since I use the number in the web URL as a parameter, I don't want people guessing what survey or form is next. By creating a very large random number the users cannot easily guess another form or survey's ID. This number is not designed for security but to keep people from being nosey and poking around easily into someone else's form or survey.
Can a table have a primary key that is randomly generated? Thanks, Lance Campbell Project Manager/Software Architect Web Services at Public Affairs University of Illinois 217.333.0382 http://webservices.uiuc.edu -----Original Message----- From: Michael Fuhr [mailto:[EMAIL PROTECTED] Sent: Thursday, June 14, 2007 8:26 AM To: Campbell, Lance Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Random Unique Integer On Thu, Jun 14, 2007 at 08:08:26AM -0500, Campbell, Lance wrote: > I have a table T1. It contains a field called F1. Is there a way for > me to set the table T1 up such that F1 can be populated with a random > integer such that F1 is a unique integer? What problem are you trying to solve? The solution might depend on what you're trying to do. -- Michael Fuhr ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq