Search code examples
postgresqlpgcrypto

HMAC postgres error - No function matches the given name and argument types


I'm getting below error while using hmac method in postgres. Please help.

root@go=# SELECT HMAC('MyPassword','mykey','md5');
ERROR:  42883: function hmac(unknown, unknown, unknown) does not exist
LINE 1: SELECT HMAC('MyPassword','mykey','md5');
               ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
LOCATION:  ParseFuncOrColumn, parse_func.c:523
Time: 0.703 ms

Solution

  • Two possibilities:

    1. You never installed pgcrypto with CREATE EXTENSION.

    2. You installed pgcrypto in a schema that is not on the search_path of database user root.