# Bug in renameColumn in 1.9.4

**URL:** <https://forum.liquibase.org/t/bug-in-renamecolumn-in-1-9-4/176>\
**Category:** General Discussion\
**Created:** [August 4, 2009, 1:07pm UTC](https://forum.liquibase.org/t/bug-in-renamecolumn-in-1-9-4/176 "2009-08-04T13:07:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![justx2](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@justx2](https://forum.liquibase.org/u/justx2)\
**Post date:** [August 4, 2009, 1:07pm UTC](https://forum.liquibase.org/t/bug-in-renamecolumn-in-1-9-4/176/1 "2009-08-04T13:07:00Z")

</div>

After I switched from Liquibase 1.9.3 to Liquibase 1.9.4, I get an error when using renameColumn.  
What happens is that instead of the expected rename to “someColumnName”, the column are now named “[someColumnName]” - the square brackets are actually a part of the column name known by the database.  
My dbms is MSSQL 2K5.

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [August 4, 2009, 1:07pm UTC](https://forum.liquibase.org/t/bug-in-renamecolumn-in-1-9-4/176/2 "2009-08-04T13:07:00Z")

</div>

What do you have in your changelog file?&nbsp; I think there was fix in 1.9.4 to add escaping to column names, were you already escaping them?

Nathan

---

<div class="post-metadata">

**Author:** ![justx2](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@justx2](https://forum.liquibase.org/u/justx2)\
**Post date:** [August 4, 2009, 1:07pm UTC](https://forum.liquibase.org/t/bug-in-renamecolumn-in-1-9-4/176/3 "2009-08-04T13:07:00Z")

</div>

No, I didn’t escape the name.  
The line in the changeset looks like this:

---

<div class="post-metadata">

**Author:** ![justx2](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@justx2](https://forum.liquibase.org/u/justx2)\
**Post date:** [August 4, 2009, 1:07pm UTC](https://forum.liquibase.org/t/bug-in-renamecolumn-in-1-9-4/176/4 "2009-08-04T13:07:00Z")

</div>

I think I found what is wrong.

renameTable generates this SQL:

exec sp\_rename 'Type]', [PersistentEntityMetaData]

renameColumn generates this SQL:

exec sp\_rename '[PersistentEntityMetaData].

TypeID]', '[PersistentEntityMetaDataID]'

but it should have generated this SQL:

exec sp\_rename '[PersistentEntityMetaData].

TypeID]', [PersistentEntityMetaDataID]

---

<div class="post-metadata">

**Author:** ![taranenko](https://avatars.discourse-cdn.com/v4/letter/t/ee7513/32.png) [@taranenko](https://forum.liquibase.org/u/taranenko)\
**Post date:** [August 4, 2009, 1:07pm UTC](https://forum.liquibase.org/t/bug-in-renamecolumn-in-1-9-4/176/5 "2009-08-04T13:07:00Z")

</div>

I think correct sql snippet should be

exec sp\_rename '[PersistentEntityMetaData].TypeID]', 'PersistentEntityMetaDataID' escaping for this case should be avoided, keeping single quotes.

see [http://msdn.microsoft.com/en-us/library/ms188351.aspx](http://msdn.microsoft.com/en-us/library/ms188351.aspx)

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [August 4, 2009, 1:07pm UTC](https://forum.liquibase.org/t/bug-in-renamecolumn-in-1-9-4/176/6 "2009-08-04T13:07:00Z")

</div>

Thanks, I created an issue for it: [http://liquibase.jira.com/browse/CORE-442](http://liquibase.jira.com/browse/CORE-442)

Nathan
