Tag Info

New answers tagged

1

As your goal is for: the end users to not able to guess the primary keys by simply incrementing numbers. then rather than just a variable increment of your keys (so they have to search a few tens or hundreds of values), why not go for something completely nonlinear? There's a function in the PostgreSQL wiki that should suit your needs, pseudo_encrypt. ...


1

I suggest a function taking a regclass parameter that runs ALTER SEQUENCE with a new randomly generated increment before it returns the next value from a given sequence. Can be used as drop-in replacement for nextval(). Per documentation on ALTER SEQUENCE: increment The clause INCREMENT BY increment is optional. A positive value will make an ...


0

You most probably need: GRANT USAGE ON SEQUENCE my_table_id_seq TO writer; Per documentation: USAGE ... For sequences, this privilege allows the use of the currval and nextval functions. nextval() is the reason you need the USAGE privilege on the sequence for a table with serial column. Details in this related answer on SO. Since a sequence ...



Top 50 recent answers are included