Skip to content

Treating “integer” data as “string” in the “entity_id” field of customer

I’m facing an intriguing issue in Magento 2, and I would like to know if anyone has come across this or has any relevant information about it. In the Magento 2 database schema, the “entity_id” field of the “customer” table is defined as an “integer” type. However, whenever Magento processes this field, it treats it as a string.

For example, when extracting the following query in the Magento database:

DELETE FROM customer_grid_flat
WHERE (entity_id IN(‘8940274’))

We can observe that the value ‘8940274’ is being passed as a string, even though the database schema defines this field as an “integer” type.

This inconsistency has intrigued me and made me question why Magento 2 converts “integer” values to “string” when handling the “entity_id” field. Is there any specific reason for this behavior? Could it be an intentional feature of Magento 2, or perhaps a potential bug?

I appreciate any information or insights you can share regarding this matter. Thank you in advance.