7 ms·
because it violates Relational Theory It doesn't violate relational theory at all -- it merely violates the query compiler's requirements about what must be kn
by tremon 3y ago
because it violates Relational Theory
It doesn't violate relational theory at all -- it merely violates the query compiler's requirements about what must be known at the time of query compilation.
You can absolute write a query that does what you want (you need a stored procedure that generates ad-hoc functions based on the involved tables' signatures), but stored sql objects must have defined inputs and outputs. What you're asking for is a meta-sql function that can translate to different query plans based on its inputs, and that's not allowed because its performance cannot be predetermined.
- Pxtl 3y agoC has had this problem solved with preprocessor macros for 50 years.