-2

I created a new database scheme using PgAdmin. But when I start Spring Boot application with Liqudbase dependency I get this error:

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:393) ~[liquibase-core-4.5.0.jar:na]

Do you know how I can fix this issue?

Peter Penzov
  • 1,126
  • 134
  • 430
  • 808

1 Answers1

0

Generally this exception is due to invalid SEARCH PATH or not having necessary privileges.

In most of the cases the first entry is invalid or the search path is empty. Fixing path settings might help solve this. You can follow this detailed guide to fix search path settings.

OR

create schema schema_name;
set search_path to schema_name;
create table foo (id int);

As far as user privileges is concerned, it is not the best way as you will need to grant permission to every user.

Huzaifa
  • 484
  • 4
  • 8
  • I found the issue schema name was with capital letters and numbers. After using small letters and numbers it's running fine. I wonder why. – Peter Penzov Aug 12 '23 at 19:32