Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

And it also breaks if two non-key columns are named the same.

This makes naming key columns differently a defence technique, so you stop people from using natural joins.



I generally use a prefix for columns based on the relation name, but preserving the name of keys (so a foreign key to user_id is user_id, not order_user_id etc). You obviously can't use natural joins if you end up with _multiple_ foreign keys with different roles, but generally I find this a better way to live all round. Never having to rename five 'name' columns in some output to make it clear which is which etc.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: