1

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

a_horse_with_no_name
  • 497,550
  • 91
  • 775
  • 843
friartuck
  • 2,624
  • 2
  • 28
  • 55
  • For full and varied answers on generating UUID in PostgreSQL, see: https://stackoverflow.com/q/12505158/6710366 – André Carvalho May 27 '22 at 17:03
  • Does this answer your question? [Generating a UUID in Postgres for Insert statement?](https://stackoverflow.com/questions/12505158/generating-a-uuid-in-postgres-for-insert-statement) – André Carvalho May 27 '22 at 17:06

1 Answers1

5

Use

CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

then you can use uuid_generate_v4().

Laurenz Albe
  • 167,868
  • 16
  • 137
  • 184
friartuck
  • 2,624
  • 2
  • 28
  • 55