by lovasoa · 3y ago · 0 comments
https://www.postgresql.org/docs/current/pgcrypto.html
The page contains the documentation of many functions, all of which raise the following error by default when you run them: No function matches the given name and argument types.
It turns out you first have to "install" them by running "create extension pgcrypto", which is obvious to someone who already knows postgres modules well, but not to anyone else, and isn't mentioned anywhere on the page!
Its like complaining your car manual doesn't say you have to open the hood of the car on the same page it explains how to change the wiper fluid.
I want to compute a sha1 hash in postgres. I make a google search, I click the first link. It says I should run `digest('mystring', 'sha1')`. It doesn't work.
Whereas it could be the following just by adding one line to the documentation:
I click the first link. It says I should run `CREATE EXTENSION pgcrypto` first. Then `digest('mystring', 'sha1')`. It works.