I’m using HSQLDB for in memory database tests and I’ve run into problems when using UUID’s as primary keys. I want my primary key to be generated by the database. The generated UUID doesn’t have to be a real uuid, it just has to go to a varchar column.
I’ve tried UUID function that should exists according to this documentation: http://hsqldb.org/doc/guide/builtinfunctions-chapt.html
alter table owner alter column id set default UUID();
But it just says that UUID is unexpected token.
Any clues?
You can use a trigger for UUID column values.
Note the column needs a default, but this default is overwritten by the UUID()