nikocraft
1 year ago
182
4
Laravel

Is naming columns with reserved words problematic?

Posted 1 year ago by nikocraft

For example, in pure PHP this guy has a problem because he has a column named key

https://stackoverflow.com/questions/23446377/syntax-error-due-to-using-a-reserved-word-as-a-table-or-column-name-in-mysql

However, I am using both 'key' and 'value' as column names in my own application which I have developed for 15 months now and never did I have a single problem with these column names.

Is Laravel escaping them with backtick as the answer suggests one should do manually? If Laravel is not escaping them how come I can use any name for the column in a table and not get problems like in the link above?

Please sign in or create an account to participate in this conversation.