News for hackers. Stuff that matters.
Re:Choosing a Postgres Primary Key by xaferel on Friday January 20, 2023 @07:50AM (#34452397)
That's a good idea but doesn't it need 2 round trips if you use an auto-increment primary key? First insert and then update by hashing the new id.
Re:Choosing a Postgres Primary Key by grncdr on Friday January 20, 2023 @07:56AM (#34452452)
Not the poster you’re replying to, but with this approach you generally don’t store the hashed identifier. Just encode/decode at the application boundaries.
Re:Choosing a Postgres Primary Key by Too on Saturday January 21, 2023 @03:22AM (#34464829)
How do you decode a hash?
Re:Choosing a Postgres Primary Key by grncdr on Sunday January 22, 2023 @08:01AM (#34476931)
ah sorry, I was not very precise about "hashed".

What I meant (and have done in the past) is to encrypt/decrypt the auto-incrementing ID at the application boundaries.

If the OP is really using a one-way hash then yes, you would have to store both IDs.