This SQL:
CREATE TABLE product_ (
pkey_ UUID PRIMARY KEY
) ;
…successfully creates a table.
But I want new rows to default to a UUId generated by RANDOM_UUID()
as shown on this Answer.
CREATE TABLE product_ (
pkey_ UUID PRIMARY KEY DEFAULT RANDOM_UUID()
) ;
But this fails with an error:
org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "CREATE TABLE PRODUCT_ ( PKEY_ UUID PRIMARY KEY DEFAULT[*] RANDOM_UUID() ) ; "; expected "HASH, AUTO_INCREMENT, NOT, NULL, CHECK, REFERENCES, ,, )"; SQL statement:
What is the cause and solution for this error?