# PostgreSQL uuid type query

**URL:** <https://forum.servoy.com/t/postgresql-uuid-type-query/20733>\
**Category:** Questions\
**Created:** [April 9, 2022, 12:41pm UTC](https://forum.servoy.com/t/postgresql-uuid-type-query/20733 "2022-04-09T12:41:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![amitchell](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/amitchell/32/5153_2.png) [@amitchell](https://forum.servoy.com/u/amitchell)\
**Post date:** [April 9, 2022, 12:41pm UTC](https://forum.servoy.com/t/postgresql-uuid-type-query/20733/1 "2022-04-09T12:41:16Z")

</div>

Hi guys,

I am new to Servoy and application development in general.

I have created a PostgreSQL DB and a ‘users’ table from within Servoy. I left the default primary key of ‘user\_uuid’, type 'UUID (DB Native), Sequence Type ‘uuid generator’ and disabled allow null.

I am trying to manually add a row of data into the table via PG Admin 4 by running the below command:

```auto
INSERT INTO users (email, first_name, last_name)
VALUES ('test@test.com', 'Bill', 'Peters');

```

However when doing to I get the below error:

```auto
null value in column "user_uuid" violates not-null constraint

```

It was my understanding I shouldn’t have to pass a value and that the user\_uuid should be automatically generated due to it having the sequence type of ‘uuid generator’ in Servoy.

What am I missing here? Any assistance would be much appreciated.

Cheers guys! ![:D]( "Very Happy")

Alex.

 ![pg_admin_error.png](https://canada1.discourse-cdn.com/flex010/uploads/servoy/original/2X/8/857c780b8ef82d175f0ef3ad1d22602d6538a7f0.png)

 ![users_table_servoy.png](https://canada1.discourse-cdn.com/flex010/uploads/servoy/original/2X/d/d3a4a22427a6d67397577db7f5217dc258cbd353.png)

---

<div class="post-metadata">

**Author:** ![swingman](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/swingman/32/4536_2.png) [@swingman](https://forum.servoy.com/u/swingman)\
**Post date:** [April 9, 2022, 12:58pm UTC](https://forum.servoy.com/t/postgresql-uuid-type-query/20733/2 "2022-04-09T12:58:55Z")

</div>

Hi Alex,

there are two strategies:

- get Servoy to insert the primary key
- get the database, in your case PostgreSQL to do it.

If you pick the first, this will make it more difficult to add data to your database outside of Servoy (like from pgAdmin).  
You can use pgAdmin to modify the primary key of your table to insert the UUID when records are created.

Take a look at something like

[https://arctype.com/blog/postgres-uuid/](https://arctype.com/blog/postgres-uuid/)

Hope this helps,

---

<div class="post-metadata">

**Author:** ![amitchell](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/amitchell/32/5153_2.png) [@amitchell](https://forum.servoy.com/u/amitchell)\
**Post date:** [April 11, 2022, 10:49am UTC](https://forum.servoy.com/t/postgresql-uuid-type-query/20733/3 "2022-04-11T10:49:06Z")

</div>

Thank you Christian for your informative response!

I will certainly reply here if I have any further issues/queries.

Cheers,

Alex ![:)]( "Smile")
