Function uuid_generate_v4() does not exist postgres 11

Rockr picture Rockr · Jun 2, 2019 · Viewed 11.8k times · Source

I am trying to use node-pg-migrate and run migrations to create tables in my node project. When I run migrations I get function uuid_generate_v4() does not exist.

I did check in my extensions and uuid-ossp is available.

extname  | extowner | extnamespace | extrelocatable | extversion | extconfig | extcondition 
-----------+----------+--------------+----------------+------------+-----------+--------------
 plpgsql   |       10 |           11 | f              | 1.0        |           | 
 uuid-ossp |    16384 |         2200 | t              | 1.1        |           | 
(2 rows)

I expect my migrations to run but it fails. I am using Postgres 11 on Mac. Postgres installed from here - https://postgresapp.com/

Answer

Purushottam Sadh picture Purushottam Sadh · Jul 23, 2020
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";