---
title: Change a Column Type in Postgres
description: When designing a database sometimes we get it wrong, here is the command you can use to change a column type for an existing table
date: 2021-04-20
tags: Postgres
source: https://brianchildress.co/blog/change-column-type-postgres
---

# Change a Column Type in Postgres

When designing a database sometimes we get it wrong, here is the command you can use to change a column type for an existing table:

```sql
ALTER TABLE <table name> ALTER COLUMN <column name> TYPE <new column type> USING <column name>::<column type>
```

_Example Use:_

```sql
ALTER TABLE files ALTER COLUMN file_id TYPE uuid USING file_id::uuid
```
