Table "Key" causing issues with generated query

Hi all!

I recently performed ./bin/cake bake all keys.
When I attempted to open the https://…//keys/index.php file the error bellow was generated:

On the other hand, the following query can be successfully queried from the database:
SELECT keys.code, users.id FROM keys LEFT JOIN users ON users.id = (keys.user_id)

I suspect that because “key” is a special term in mysql, it is causing issues within the statement.
Is there a way to go around this issue without renaming the table since “keys” are exactly what we are trying to manage?

You can enable identifier quoting, but as noted there are performance drawbacks to doing so. It would at least be a good thing to try to make sure that this is in fact the source of the problem.

1 Like

Thank you, I think that’s the case because, without quoting the keyword keys these errors are produced:

Meanwhile, by quoting the first “keys” the error at position 7 disappeared.