3 ms·
I never understood why the thing named "natural join" don't use relationships to determine the joining columns. Does not look natural for me.
by marcosdumay 11y ago
I never understood why the thing named "natural join" don't use relationships to determine the joining columns. Does not look natural for me.
- vog 11y agoIndeed, this is also what always annoyed me. I suspect that this has to do with the fact that NATURAL JOIN is intended to work for sub-SELECTs and VIEWs, too. On those, it is quite hard and error-prone to determine "foreign key" equivalents. Also note that restricting NATURAL JOINs to tables wouldn't be a good solution here, either, because that would prevent you from ever JOINing more than 2 tables: When JOINing 3 tables, you effectively do have some kind of sub SELECT after having joined the first two tables, which is then supposed to be joined with the third one.
- marcosdumay 11y agoYou get the same sort of problems jessedhillon was talking about. That is, you lose absolutely nothing - just changes its semantics.