# Issue with ExpectColumnValuesToBeOfType Expectation For Postgres Database

**URL:** <https://discourse.greatexpectations.io/t/issue-with-expectcolumnvaluestobeoftype-expectation-for-postgres-database/2185>\
**Category:** GX Core Support\
**Tags:** help-wanted, types-of-expectation\
**Created:** [April 23, 2025, 6:26pm UTC](https://discourse.greatexpectations.io/t/issue-with-expectcolumnvaluestobeoftype-expectation-for-postgres-database/2185 "2025-04-23T18:26:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vijaykumar](https://avatars.discourse-cdn.com/v4/letter/v/4491bb/32.png) [@vijaykumar](https://discourse.greatexpectations.io/u/vijaykumar)\
**Post date:** [April 23, 2025, 6:26pm UTC](https://discourse.greatexpectations.io/t/issue-with-expectcolumnvaluestobeoftype-expectation-for-postgres-database/2185/1 "2025-04-23T18:26:30Z")

</div>

Hello Everyone,

We got an Issue while performing Validation on Postgres database with below expectation

```auto
expectation_with_condition2 = gx.expectations.ExpectColumnValuesToBeOfType(column="asset_type_id", type_="INTEGER")

```

Error

```auto
{
  "success": false,
  "expectation_config": {
    "type": "expect_column_values_to_be_of_type",
    "kwargs": {
      "column": "asset_type_id",
      "type_": "INTEGER",
      "batch_id": "postgres_datasource-SFI_Table_Asset"
    },
    "meta": {}
  },
  "result": {},
  "meta": {},
  "exception_info": {
    "exception_traceback": "Traceback (most recent call last):\n File \"C:\\Users\\vijaykuma_g\\Downloads\\Python_GX\\gp_new\\Lib\\site-packages\\great_expectations\\validator\\validator.py\", line 650, in graph_validate\n result = expectation.metrics_validate(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"C:\\Users\\vijaykuma_g\\Downloads\\Python_GX\\gp_new\\Lib\\site-packages\\great_expectations\\expectations\\expectation.py\", line 1150, in metrics_validate\n expectation_validation_result: Union[ExpectationValidationResult, dict] = self._validate(\n ^^^^^^^^^^^^^^^\n File \"C:\\Users\\vijaykuma_g\\Downloads\\Python_GX\\gp_new\\Lib\\site-packages\\great_expectations\\expectations\\core\\expect_column_values_to_be_of_type.py\", line 568, in _validate\n type_dict[\"type\"]\n ~~~~~~~~~ ^^^^^^^^\nKeyError: 'type'\n",
    "exception_message": "'type'",
    "raised_exception": true
  }
}

```

This expectation works fine with Pandas, bur not in Postgres  
It seems there was a problem while retrieving column types . can some one help me on this , this would be really helpful.

Thanks in advance  
Vijay

---

<div class="post-metadata">

**Author:** ![hdataeng](https://avatars.discourse-cdn.com/v4/letter/h/34f0e0/32.png) [@hdataeng](https://discourse.greatexpectations.io/u/hdataeng)\
**Post date:** [April 25, 2025, 2:10pm UTC](https://discourse.greatexpectations.io/t/issue-with-expectcolumnvaluestobeoftype-expectation-for-postgres-database/2185/2 "2025-04-25T14:10:21Z")

</div>

i have the same issue with DATABRICKS SQL data source
