---
id: 3017
title: Enable UUID on PostgreSQL
slug: enable-uuid-on-postgresql
date: '2019-08-01T10:41:01Z'
modified: '2019-08-01T10:41:01Z'
status: publish
type: post
author: pmoelgaard
categories:
  - PostgreSQL
tags: []
excerpt: null
canonicalPath: /posts/enable-uuid-on-postgresql
featuredImage: null
commentCount: 0
wordCount: 61
readingTimeMinutes: 1
hasMedia: false
hasVideos: false
url: 'https://forwardthinking.pemo.me/posts/enable-uuid-on-postgresql'
---
Sometimes we want to have native support for UUID's in Postgres, fortunately there is already a ready-made extension that makes it easy. Enter the "uuid-ossp" extension... fortunately furthermore, its very easy to use...

1.  Enable the extension:
    
    > CREATE EXTENSION IF NOT EXISTS "uuid-ossp"
    
2.  Set default value on the column to "expression" and use the following default value:
    
    > uuid\_generate\_v4()
