We followed the instructions to generate UUIDs. It worked for awhile, and then we got to around 4,900 records in the table, the UUID was no longer unique for a particular record. We were able to catch this because we set up an isDup function on the UUID column (i.e. “DUP” if len(Email_subscribers.lookupRecords(UUID=$UUID)) > 1 else “”). Now, every single new record we enter into the table, simply duplicates a prior UUID.
This is quite concerning,. How can UUID generate non-unique values in one specific table? That means it’s not really a UUID. So how do we you generate a UUID that is actually unique per record in a table? I’ver never seen this happen in postgres database, so maybe this is a limitation of sqllite? Very strange behavior.
BTW, our code for the table is as per below. This fires as a trigger on every new record. I have attempted to enter many new records and I can confirm that every new record created now simply duplicates a prior UUID, so UUID does not generate anything unique. We are on the hosted version of Grist.
def _default_UUID(rec, table, value, user):
return UUID()
UUID = grist.Text()