Hello.
I have problems creating a View in my PostgreSQL schema with Liquibase. If I create the View manually in my schema it works, but if try to use following change log it fails;
- SELECT wl.worklog_id,
- d.driver_id,
- d.personal_id,
- d.forename,
- d.surname,
- extract(year from wl.date) as year,
- extract(month from wl.date) as month,
- extract(day from wl.date) as day,
- wl.start_time,
- wl.end_time,
- wl.end_time - wl.start_time as work_time,
- t.tour_id as tour_id,
- t.name as tour_name
- FROM worklogs wl left outer join drivers d on wl.driver_id=d.driver_id
- left outer join tours t on wl.tour_id=t.tour_id
- ORDER BY d.surname,
- d.forename,
- wl.date
-
This Exception is thrown:
- Liquibase Home is not set.
Liquibase Home: /home/crazydoc/programme/liquibase
INFO 30.04.12 15:33:liquibase: Successfully acquired change log lock
INFO 30.04.12 15:33:liquibase: Reading from schema_name.databasechangelog
INFO 30.04.12 15:33:liquibase: Reading from schema_name.databasechangelog
SEVERE 30.04.12 15:33:liquibase: Change Set src/main/liquibase/first-views.xml::view-worklogs_report_postgresql::NormanKnott failed. Error: Error executing SQL CREATE VIEW schema_name.worklogs_report AS SELECT wl.worklog_id,
d.driver_id,
d.personal_id,
d.forename,
d.surname,
extract(year from wl.date) as year,
extract(month from wl.date) as month,
extract(day from wl.date) as day,
wl.start_time,
wl.end_time,
wl.end_time - wl.start_time as work_time,
t.tour_id as tour_id,
t.name as tour_name
FROM worklogs wl left outer join drivers d on wl.driver_id=d.driver_id
left outer join tours t on wl.tour_id=t.tour_id
ORDER BY d.surname,
d.forename,
wl.date: ERROR: relation “worklogs” does not exist
Position: 444
liquibase.exception.DatabaseException: Error executing SQL CREATE VIEW schema_name.worklogs_report AS SELECT wl.worklog_id,
d.driver_id,
d.personal_id,
d.forename,
d.surname,
extract(year from wl.date) as year,
extract(month from wl.date) as month,
extract(day from wl.date) as day,
wl.start_time,
wl.end_time,
wl.end_time - wl.start_time as work_time,
t.tour_id as tour_id,
t.name as tour_name
FROM worklogs wl left outer join drivers d on wl.driver_id=d.driver_id
left outer join tours t on wl.tour_id=t.tour_id
ORDER BY d.surname,
d.forename,
wl.date: ERROR: relation “worklogs” does not exist
Position: 444
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:61)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:108)
at liquibase.database.AbstractDatabase.execute(AbstractDatabase.java:1091)
at liquibase.database.AbstractDatabase.executeStatements(AbstractDatabase.java:1075)
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:114)
at liquibase.integration.commandline.Main.doMigration(Main.java:821)
at liquibase.integration.commandline.Main.main(Main.java:134)
Caused by: org.postgresql.util.PSQLException: ERROR: relation “worklogs” does not exist
Position: 444
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:374)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:366)
at liquibase.executor.jvm.JdbcExecutor$1ExecuteStatementCallback.doInStatement(JdbcExecutor.java:96)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:54)
… 9 more
INFO 30.04.12 15:33:liquibase: Successfully released change log lock
Liquibase Update Failed: Error executing SQL CREATE VIEW makno_prod.worklogs_report AS SELECT wl.worklog_id, - …
This is my commandline:
- liquibase --classpath=postgresql-9.0-801.jdbc4.jar --driver=org.postgresql.Driver --changeLogFile=src/main/liquibase/changelog-master.xml --url=jdbc:postgresql://localhost/dbname --username=admin --defaultSchemaName=schema_name update