Daniel Stephens
Daniel Stephens

Reputation: 3209

How to enable extensions in PostgreSQL?

I have the following SQL snippet:

CREATE TABLE chat (
    message_uuid    UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
);

which fails with the following error message:

ERROR:  function uuid_generate_v4() does not exist

As far as I can see, I need an extension to make use of this function. Does anyone know how I can activate it? The function seems to exist according to the documentation

Upvotes: 2

Views: 3007

Answers (1)

HelloWorld
HelloWorld

Reputation: 1863

You have to enable the uuid-ossp extension. Execute this statement:

CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

Upvotes: 5

Related Questions