Tag Archives: Pgsql Error

Pgsql Error: function uuid_generate_v4() does not exist [How to Solve]

Error message

bad SQL grammar []; nested exception is org.postgresql.util.PSQLException: ERROR: function uuid_generate_v4() does not exist

nested exception is org.postgresql.util.PSQLException: ERROR: function uuid_generate_v4() does not exist

 

It is caused by the absence of the uuid_generate_v4 function.

The reason for this problem is that the uuid function uuid_generate_v4() is in the Postgresql extension by default. After the database is migrated, the extension extension is gone and needs to be reinstalled.

 

 

Solution:
Execute in sql query

CREATE EXTENSION pgcrypto;

Can

In addition, adding uuid support to PG only needs to run in sql

create extension "uuid-ossp"

Test function:

select uuid_generate_v4()