Generate gen_random_uuid()
for the column key
if there count(key) < 1
My table
name is keytable
and column
is key
.
I am using the below insert
statement to generate the uuid : that is the only value in the table.
INSERT INTO keytable VALUES(gen_random_uuid());
key
---------------------------------------
5686473e-add1-4ab1-be85-7e62152ce539
I wanted to run this insert
statement only when i dont have any values in my "key" column.
in other words, if count(key) < 1
then i want to run the INSERT INTO keytable VALUES(gen_random_uuid());
Please help.