syntax for modify Column Data Type

how can i modify column data type in liquibase
i am using postgres SQL

http://lmgtfy.com/?q=liquibase+%22modify+data+type%22&l=1

Best,
Laird

i tried like mentioned below ,but it's not working ikn Postgresql

<modifyDataType tableName="person" columnName="firstname" newDataType="varchar(500)"/>
<modifyDataType tableName="person" columnName="firstname" newDataType="java.sql.Types.VARCHAR(500)"/>
i tried like mentioned below ,but it's not working ikn Postgresql

<modifyDataType tableName="person" columnName="firstname" newDataType="varchar(500)"/>
<modifyDataType tableName="person" columnName="firstname" newDataType="java.sql.Types.VARCHAR(500)"/>

i created a table temp with id int and custName varchar(500),it’s created.
now iam trying to modify data type of custName varchar(500) to char(300),and i am getting error like mentioned below.


INFO 7/14/11 11:19 AM:liquibase: Successfully acquired change log lock
INFO 7/14/11 11:19 AM:liquibase: Reading from databasechangelog
INFO 7/14/11 11:19 AM:liquibase: Reading from databasechangelog
SEVERE 7/14/11 11:19 AM:liquibase: Error executing SQL ALTER TABLE temp ALTER COLUMN “custName” TYPE CHAR(300)
org.postgresql.util.PSQLException: ERROR: syntax error at or near “TYPE”
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1608)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1343)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:194)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:336)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:328)
        at liquibase.executor.jvm.JdbcExecutor$1ExecuteStatementCallback.doInStatement(JdbcExecutor.java:92)
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:105)
        at liquibase.database.AbstractDatabase.execute(AbstractDatabase.java:1014)
        at liquibase.database.AbstractDatabase.executeStatements(AbstractDatabase.java:998)
        at liquibase.changelog.ChangeSet.execute(ChangeSet.java:317)
        at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:27)
        at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58)
        at liquibase.Liquibase.update(Liquibase.java:113)
        at liquibase.integration.commandline.Main.doMigration(Main.java:684)
        at liquibase.integration.commandline.Main.main(Main.java:116)
SEVERE 7/14/11 11:19 AM:liquibase: Change Set ./changelog_ps1.xml::12::a1106 failed.  Error: Error executing SQL ALTER TABLE temp ALTER COLUMN “custName” TYPE CHAR(300): ERROR: syntax error at or near "TYPE"
liquibase.exception.DatabaseException: Error executing SQL ALTER TABLE temp ALTER COLUMN “custName” TYPE CHAR(300): ERROR: syntax error at or near “TYPE”
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:62)
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:105)
        at liquibase.database.AbstractDatabase.execute(AbstractDatabase.java:1014)
        at liquibase.database.AbstractDatabase.executeStatements(AbstractDatabase.java:998)
        at liquibase.changelog.ChangeSet.execute(ChangeSet.java:317)
        at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:27)
        at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58)
        at liquibase.Liquibase.update(Liquibase.java:113)
        at liquibase.integration.commandline.Main.doMigration(Main.java:684)
        at liquibase.integration.commandline.Main.main(Main.java:116)
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near “TYPE”
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1608)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1343)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:194)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:336)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:328)
        at liquibase.executor.jvm.JdbcExecutor$1ExecuteStatementCallback.doInStatement(JdbcExecutor.java:92)
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
        … 9 more
INFO 7/14/11 11:19 AM:liquibase: Successfully released change log lock
Liquibase Update Failed: Error executing SQL ALTER TABLE temp ALTER COLUMN “custName” TYPE CHAR(300): ERROR: syntax error at or near "TYPE"
SEVERE 7/14/11 11:19 AM:liquibase: Error executing SQL ALTER TABLE temp ALTER COLUMN “custName” TYPE CHAR(300): ERROR: syntax error at or near "TYPE"
liquibase.exception.MigrationFailedException: Migration failed for change set ./changelog_ps1.xml::12::a1106:
     Reason: liquibase.exception.DatabaseException: Error executing SQL ALTER TABLE temp ALTER COLUMN “custName” TYPE CHAR(300): ERROR: syntax error at or near “TYPE”:
          Caused By: Error executing SQL ALTER TABLE temp ALTER COLUMN “custName” TYPE CHAR(300): ERROR: syntax error at or near “TYPE”:
          Caused By: ERROR: syntax error at or near “TYPE”
        at liquibase.changelog.ChangeSet.execute(ChangeSet.java:347)
        at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:27)
        at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58)
        at liquibase.Liquibase.update(Liquibase.java:113)
        at liquibase.integration.commandline.Main.doMigration(Main.java:684)
        at liquibase.integration.commandline.Main.main(Main.java:116)
Caused by: liquibase.exception.DatabaseException: Error executing SQL ALTER TABLE temp ALTER COLUMN “custName” TYPE CHAR(300): ERROR: syntax error at or near “TYPE”
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:62)
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:105)
        at liquibase.database.AbstractDatabase.execute(AbstractDatabase.java:1014)
        at liquibase.database.AbstractDatabase.executeStatements(AbstractDatabase.java:998)
        at liquibase.changelog.ChangeSet.execute(ChangeSet.java:317)
        … 5 more
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near “TYPE”
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1608)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1343)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:194)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:336)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:328)
        at liquibase.executor.jvm.JdbcExecutor$1ExecuteStatementCallback.doInStatement(JdbcExecutor.java:92)
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
        … 9 more

version postgres 7.1

What is the error you are getting?

Nathan

From the postgres docs, it looks like <span class=“Apple-style-span” TYPE CHAR(300) should be the correct SQL. What version of postgres are you running? Do you know what the correct SQL should be?

Nathan