5 ms·
> inconsistent data fields being returned by various queries, resulting in inconsistent api endpoint data returned to the client and thus inability to safely ab
by fnord123 10y ago
> inconsistent data fields being returned by various queries, resulting in inconsistent api endpoint data returned to the client and thus inability to safely abstract without significant hacks/nebulous data model state.
You are coding against actual queries? Why not functions to hide the table abstractions:
https://www.postgresql.org/docs/current/static/sql-createfunction.html https://www.postgresql.org/docs/current/static/sql-createfun...
https://dev.mysql.com/doc/refman/5.7/en/create-procedure.html https://dev.mysql.com/doc/refman/5.7/en/create-procedure.htm...
>We had no ability to gate content by various values from other tables without modifying the handrolled SQL in every single location
Again, don't sql functions solve this?
- icebraining 10y agoThat's essentially building an ORM (well, a data mapping layer) out of PL/SQL functions rather than your main language. Why would that be better?
- TimJYoung 10y agoI think he's saying that there was a lot of duplication in the client SQL for various applications (copy/paste, probably). Using SQL functions/procedures/views to return the same result sets would eliminate the duplication and provide "one true source" for such queries. Plus, it would reside in the actual database, allowing it to be portable and not requiring any extra work in the client applications.
- fnord123 10y agoYes, exactly. Also, tables could be refactored without having to update clients.
- ajuc 10y agoTo play devil's advocate - PL/SQL is much closer to SQL than Java/C#/C++/.... The impedance mismatch between relational and OO is much bigger.
- ch4s3 10y ago>Why not functions to hide the table abstractions Isn't that roughly what an ORM/ODM is?
- fnord123 10y agoORM is in the client. I'm talking about making wrapping functions for popular views in the database itself.