Bamboo fails to start after PostgreSQL migration with error relation build does not exist
Platform Notice: Data Center Only - This article only applies to Atlassian apps on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Problem
Bamboo fails to start after migrating PostgreSQL database to another PostgreSQL server with the following steps:
Migrate PostgreSQL server through
pg_dumpto another serverConfigure
bamboo.cfg.xmlto refer to the new PostgreSQL server
The following appears in the atlassian-bamboo.log
2017-08-24 15:59:22,866 ERROR [localhost-startStop-1] [AbstractUpgradeManager] org.postgresql.util.PSQLException: ERROR: relation "build" does not exist
Position: 34
org.postgresql.util.PSQLException: ERROR: relation "build" does not exist
Position: 34
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2310)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2023)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:217)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:421)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:318)
at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:281)
at com.mchange.v2.c3p0.impl.NewProxyStatement.executeQuery(NewProxyStatement.java:327)
at com.atlassian.bamboo.upgrade.tasks.validation.PlanKeysCorrectlyFormatted$1.doInHibernateTransaction(PlanKeysCorrectlyFormatted.java:39)
at com.atlassian.bamboo.upgrade.AbstractBootstrapUpgradeTask.withDatabaseConnection(AbstractBootstrapUpgradeTask.java:69)Diagnosis
Run the following SQL query to check if there is a search_path configured for the database user:
SELECT r.rolname, d.datname, rs.setconfig
FROM pg_db_role_setting rs
LEFT JOIN pg_roles r ON r.oid = rs.setrole
LEFT JOIN pg_database d ON d.oid = rs.setdatabase
WHERE r.rolname = 'databaseUser' OR d.datname = 'databaseName';Replace databaseUser and databaseName with the settings in bamboo.cfg.xml
If there is no result, it means that the database user is using the default search_pathpublic
Cause
PostgreSQL is using the
search_pathpublic by defaultThe database dump is migrated to a custom schema and/or the database user is configured with incorrect
search_path
Solution
Resolution
Configure the database user to use the correct search_path with the following SQL and restart Bamboo:
ALTER ROLE databaseUser SET search_path TO customSchema;Replace databaseUser and customSchema with the correct settings
Was this helpful?