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

I believe this is what foreign keys are for, and also, they are usually both ints/uuids/etc so generally they are interchangeable.

I fail to see how

  customer.id = product.id
is any less obvious of a bug than

  customer.customerID = product.productID


With aliases that first expression might be:

  c.id = p.id
That seems like an easy error to make...


> With aliases that first expression might be: c.id = p.id

Which is why I don't use aliases, so that future me doesn't have to wonder what the hell he wrote a few months ago.


Once an application has been alive for more than a few months, I find it often is subject to self-joins and other query approaches which pretty much beg for aliases in the name of legibility.


subject to self-joins and other query approaches

Which means that the original argument about reserveration_id vs id doesn't matter since it's likely that both table and column aliases would be needed anyways.




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

Search: