PostgreSQL: Working with Universally Unique Identifier – UUID Data type

The PostgreSQL provides Universally Unique Identifier -UUID data type and related functions.

In the previous post, I have already shared the truth about Universally Unique Identifier - UUID.
You can visit this article here.

PostgreSQL provides two extensions.
1. uuid-ossp 2. pgcrypto.

You can install this extension using this script.

I am using pgcrypto extension for generating a UUID.

Below is a small demonstration:
Generate UUID using gen_random_uuid():

Create a sample table with UUID Data type:

Insert sample data:

The Result:


Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

If you like this post, then please share it with others.
Please follow, I will share my experience towards the success of Database Research and Development Activity.

I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.

More from

Leave a Reply

3 Comments on "PostgreSQL: Working with Universally Unique Identifier – UUID Data type"

Notify of
Sort by:   newest | oldest | most voted

Respect to author, some fantastic selective information.


You made certain nice points there. I did a search on the issue and found nearly all persons will consent with your blog.


Great post anvesh…..