---
title: "How to Fix Invalid Column Data Type when Reindex Magento 2"
url: "https://magecomp.com/blog/fix-invalid-column-data-type-when-reindex-magento-2/"
date: "2022-05-16T13:26:36+00:00"
modified: "2025-02-19T05:31:40+00:00"
author:
  name: "Dhiren Vasoya"
  url: "https://magecomp.com/"
categories:
  - "How To"
  - "Magento 2"
word_count: 290
reading_time: "2 min read"
summary: "Hello Magento Friends,"
description: "You may face an error like Invalid Column Data Type when reindexing in Magento 2. Learn how to solve it"
keywords: "How To, Magento 2"
language: "en"
schema_type: "Article"
related_posts:
  - title: "How to assign guest customers orders into registered account in Magento 2?"
    url: "https://magecomp.com/blog/assign-guest-customers-orders-into-registered-account-in-magento-2/"
  - title: "How to Disable MSI in Magento 2?"
    url: "https://magecomp.com/blog/how-to-disable-msi-in-magento-2/"
  - title: "How to Setup Google Analytics in Magento with Google Tag Manager"
    url: "https://magecomp.com/blog/setup-google-analytics-magento-with-google-tag-manager/"
---

# How to Fix Invalid Column Data Type when Reindex Magento 2

_Published: May 16, 2022_  
_Author: Dhiren Vasoya_  

![How to Fix Invalid Column Data Type when Reindex Magento 2](https://magecomp.com/blog/wp-content/uploads/2022/05/How-to-Fix-Invalid-Column-Data-Type-when-Reindex-Magento-2-1024x512.webp)

**Hello Magento Friends,**

In this blog, I am going to provide a solution to Fix Invalid Column Data Type when Reindex Magento 2.
[![hyva theme development](https://magecomp.com/blog/wp-content/uploads/2025/02/hyva-theme-development-CTA-4.webp)](https://magecomp.com/services/hyva-theme-development/)

Reindexing is required when the store data changes to increase the performance of the Magento 2 storefront. You can perform [**reindex through the command line**](https://magecomp.com/blog/magento-2-flush-cache-and-reindex-from-command-line/) or [**reindex programmatically**](https://magecomp.com/blog/how-to-perform-reindexing-programmatically-in-magento-2/) in Magento 2.
But sometimes the reindex command throws an error of invalid column data type as shown in the below image
[![invalid column data type error](https://magecomp.com/blog/wp-content/uploads/2022/05/invalid-column-data-type-error.png)](https://magecomp.com/blog/wp-content/uploads/2022/05/invalid-column-data-type-error.png)

Let’s see How to Fix Invalid Column Data Type when Reindex Magento 2
## Steps to Fix Invalid Column Data Type when Reindex Magento 2:
**Step 1:** Go to the below path
**vendor/magento/module-eav/Model/ResourceModel/Helper.php**

Insert the following lines into **getDdlTypeByColumnType() function**

```
	  case 'int unsigned':
                $columnType = 'int';
                break;
            case 'smallint unsigned':
                $columnType = 'smallint';
                break;
            case 'bigint unsigned':
                 $columnType = 'bigint';
                 break;
```

So the getDdlTypeByColumnType() function before looked like this
```
public function getDdlTypeByColumnType($columnType)
{
    switch ($columnType)
    {
        case 'char':
        case 'varchar':
            $columnType = 'text';
            break;
        case 'tinyint':
            $columnType = 'smallint';
            break;
        default:
            break;
    }
    return array_search($columnType, $this->_ddlColumnTypes);
}
```

And now the getDdlTypeByColumnType() function has changed as below
```
public function getDdlTypeByColumnType($columnType)
{
     switch ($columnType)
     {
            case 'int unsigned':
                $columnType = 'int';
                break;
            case 'smallint unsigned':
                $columnType = 'smallint';
                break;
            case 'bigint unsigned':
                 $columnType = 'bigint';
                 break;
            case 'char':
            case 'varchar':
                $columnType = 'text';
                break;
            case 'tinyint':
                $columnType = 'smallint';
                break;
            default:
                break;
     }
     return array_search($columnType, $this->_ddlColumnTypes);
}
```

## [![Magento version upgrade](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-2-Version-Upgrade-CTA-3.webp)](https://magecomp.com/services/magento-upgrade-services/)

## Conclusion:
Hence, this way you can get rid of Invalid Column Data Type while Reindexing in Magento 2. Additionally, if you face an error like **“index is locked by another reindex process. Skipping.” while reindexing in Magento 2**, you can easily solve it – [**Check the steps**](https://magecomp.com/blog/unlock-reindex-process-in-magento-2/)

Eliminate running the reindex command every time, instead perform reindexing with just a one-click from the admin dashboard. Integrate [**Magento 2 Admin Reindex Plugin**](https://magecomp.com/magento-2-admin-reindex-and-quick-cache.html).
[![Magento 2 Speed & Performance Optimization Services](https://magecomp.com/blog/wp-content/uploads/2023/10/Magento-2-Speed-Performance-Optimization-Services-CTA-4.webp)](https://magecomp.com/magento-performance-optimization.html)

**Happy Coding!**


---

_View the original post at: [https://magecomp.com/blog/fix-invalid-column-data-type-when-reindex-magento-2/](https://magecomp.com/blog/fix-invalid-column-data-type-when-reindex-magento-2/)_  
_Served as markdown by [Third Audience](https://github.com/third-audience) v3.5.3_  
_Generated: 2026-09-21 11:30:47 UTC_  
