Skip to content

Liquibase with Testcontainer: Schema in DataSources-Configuration lead to infinite loop #253

@tqad

Description

@tqad

Issue description

Hi,

I'm not sure if this is a bug or a missing documentation task.

When I configure liquibase with testcontainer in the application-test.yml for my unit test, setting datasources.default.schema results in an infinite loop inside liquibase (see logs).

Logs:
Apr. 03, 2022 2:46:04 PM liquibase.database
INFORMATION: Set default schema name to null
14:46:04.550 [Test worker] ERROR i.m.l.LiquibaseMigrationRunner - Migration failed! Liquibase encountered an exception.
liquibase.exception.LockException: liquibase.exception.DatabaseException: ERROR: no schema has been selected to create in
Position: 14 [Failed SQL: (0) CREATE TABLE databasechangeloglock (ID INTEGER NOT NULL, LOCKED BOOLEAN NOT NULL, LOCKGRANTED TIMESTAMP WITHOUT TIME ZONE, LOCKEDBY VARCHAR(255), CONSTRAINT databasechangeloglock_pkey PRIMARY KEY (ID))]
at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:329)
at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:247)
at liquibase.Liquibase.lambda$update$1(Liquibase.java:214)
at liquibase.Scope.lambda$child$0(Scope.java:180)
...
Caused by: liquibase.exception.DatabaseException: ERROR: no schema has been selected to create in
Position: 14 [Failed SQL: (0) CREATE TABLE databasechangeloglock (ID INTEGER NOT NULL, LOCKED BOOLEAN NOT NULL, LOCKGRANTED TIMESTAMP WITHOUT TIME ZONE, LOCKEDBY VARCHAR(255), CONSTRAINT databasechangeloglock_pkey PRIMARY KEY (ID))]
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:397)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:83)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:151)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:135)
at liquibase.lockservice.StandardLockService.init(StandardLockService.java:115)
at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:286)
... 131 common frames omitted
Caused by: org.postgresql.util.PSQLException: ERROR: no schema has been selected to create in
Position: 14
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2674)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2364)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:354)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:484)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:404)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:325)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:311)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:287)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:282)
at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:94)
at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:393)
... 136 common frames omitted

I use:

  • io.micronaut:micronaut-bom:3.4.0
  • io.micronaut.liquibase:micronaut-liquibase:5.2.0
  • io.micronaut.sql:micronaut-jdbc-hikari:4.2.2
  • org.postgresql:postgresql:42.3.1 (*)
  • org.testcontainers:junit-jupiter:1.16.2 (*)
  • org.testcontainers:postgresql:1.16.2 (*)
  • org.testcontainers:testcontainers:1.16.2 (*)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions