Remove code rand1.sql
article thumbnail

Generate unique random values directly in the database

Derek Sivers

You often need to generate random strings, like for login cookies and unique entry codes. result = result || chars[1 + (get_byte(rand, i) % array_length(chars, 1))]; end loop; return result; end; $$ language plpgsql; download code. eP3X7yqe download code. insert into things (name) values ('one') returning *; code ?

40