Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Function uuid_generate_v4() does not exist postgres 11

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/

like image 585
Rockr Avatar asked Jun 01 '19 23:06

Rockr


People also ask

What is UUID data type in PostgreSQL?

UUID is an abbreviation for Universal Unique Identifier defined by RFC 4122 and has a size of 128-bit. It is created using internal algorithms that always generate a unique value. PostgreSQL has its own UUID data type and provides modules to generate them.

What is create extension in PostgreSQL?

Description. CREATE EXTENSION loads a new extension into the current database. There must not be an extension of the same name already loaded. Loading an extension essentially amounts to running the extension's script file.

What is UUID OSSP?

The uuid-ossp module provides functions to generate universally unique identifiers (UUIDs) using one of several standard algorithms. There are also functions to produce certain special UUID constants. This module is only necessary for special requirements beyond what is available in core PostgreSQL.


1 Answers

CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
like image 92
Purushottam Sadh Avatar answered Sep 28 '22 02:09

Purushottam Sadh