4 ms·
Yes, the issue you run into is that then your server has to make sure your json is the right shape. CouchDB actually solves that problem really well IMO. You u
by HumanDrivenDev 9y ago
Yes, the issue you run into is that then your server has to make sure your json is the right shape.
CouchDB actually solves that problem really well IMO. You upload a validation function in javascript to the database that will validate every document that comes in. I wonder if the same thing can't be done with trigger functions in postgres.
- saltcured 9y agoYou 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."