I have a table with numeric column names. Hibernate was able to escape them and produce proper sql.
Liquibase fails when trying to perform the db change and creating the table with the names.
The changeset:
being executed via ant:
-
BUILD FAILED
liquibase.exception.MigrationFailedException: Migration failed for change set /home/phurrelmann/svn/trunk/logic/hibernate-changelog.xml::test0815::phurrelmann:
Reason: liquibase.exception.DatabaseException: Error executing SQL CREATE TABLE test (test_id bigserial NOT NULL, 1_columnx VARCHAR(255), 2_columny VARCHAR(255), CONSTRAINT "testPK" PRIMARY KEY (test_id)):
Caused By: Error executing SQL CREATE TABLE test (test_id bigserial NOT NULL, 1_columnx VARCHAR(255), 2_columny VARCHAR(255), CONSTRAINT "testPK" PRIMARY KEY (test_id)):
Caused By: ERROR: syntax error at or near "1"
Position: 48
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:281)
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:27)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:39)
at liquibase.Liquibase.update(Liquibase.java:112)
at liquibase.integration.ant.DatabaseUpdateTask.execute(DatabaseUpdateTask.java:45)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: liquibase.exception.DatabaseException: Error executing SQL CREATE TABLE test (test_id bigserial NOT NULL, 1_columnx VARCHAR(255), 2_columny VARCHAR(255), CONSTRAINT "testPK" PRIMARY KEY (test_id))
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:61)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:92)
at liquibase.database.AbstractDatabase.execute(AbstractDatabase.java:960)
at liquibase.database.AbstractDatabase.executeStatements(AbstractDatabase.java:947)
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:252)
... 21 more
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "1"
Position: 48
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:353)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:345)
at liquibase.executor.jvm.JdbcExecutor$1ExecuteStatementCallback.doInStatement(JdbcExecutor.java:83)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:54)
... 25 more
Total time: 4 seconds
How can the column names be escaped/quoted? This is on postgreSQL 8.4, btw.