Search code examples
sqlpostgresqluuid

Generate a UUID in Postgres


My tables make use of UUID values. I am inserting rows using SQL SQLWorkbench/J but I don't see how I can generate UUIDs when performing a SQL INSERT INTO (-want-to-generate-uuid-here, '5', 'some value'). Is there a way to generate UUIDs with SQLWorkBench/J?

Thanks


Solution

  • Use

    CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
    

    then you can use uuid_generate_v4().