Sample Header Ad - 728x90

Do I need to execute "create extension pgcrypto" everytime?

5 votes
1 answer
20492 views
I have used crypt() in one of my functions to hash user password. But what I observed the next day I started my pc that the same thing failed as cryptographic functions became unavailable upon restart. It showed message like functions gen_salt() / crypt() is unknown or not defined. I executed create extension pgcrypto; once and it started working. How to handle this in prod environment? Is there a way to make this module permanently available in db even if db is restarted? Or do I have to instruct server manager to run this command in case they required to restart db server? Or **can** I write this statement in functions itself so that it will create the extension every time before using cryptographic functions? Moreover, we are using a read-replica of db, where it did not allowed to execute this "create extension" statement as there is read permission only. So how to make this cryptographic functions available in such read-only environment?
Asked by Arjun_TECH (153 rep)
Feb 6, 2018, 11:27 AM
Last activity: Jul 8, 2019, 10:45 PM