3 ms·
You don't even need to use triggers. You can just write a plain old CHECK constraint on the column storing the document and use a SQL expression with the built
by saltcured 9y ago
You don't even need to use triggers. You can just write a plain old CHECK constraint on the column storing the document and use a SQL expression with the built-in JSON/JSONB operators or a stored function to interrogate the document how ever you'd like, evaluating to a true value to accept the data or false to reject.
- ris 9y agoYou can but complex datatypes (json) have complex (and often ugly) constraint definitions. It's not much fun compared to "look, I just want this field to be a date."