How to generate the UUIDv4 value?

I need to insert a new record into the database table.
I need to specify the ID field value (UUIDv4).

Is there an existing function?
Or do I need to implement some manual UUID generation?
Like in example

@ivp Here’s an example app that shows how to generate UUID using Math.random but as mentioned in the link you shared this is not advisable. What database are you using?

https://app.appsmith.com/app/framework/custom-uuid-622e4e790bf98b2d5df75f26

What database are you using?

PostgreSQL

Check out this post - postgresql - Generating a UUID in Postgres for Insert statement? - Stack Overflow

@dancia
Yes, I understand that UUID can be generated on the DB-level too.
But, thanks for the exact link!

1 Like