From 40bdab00dd3cb2811ee49a36265c29c018c48c47 Mon Sep 17 00:00:00 2001 From: Adrienne Sox <35899247+adriennesox@users.noreply.github.com> Date: Thu, 3 Oct 2024 16:27:25 -0400 Subject: [PATCH] Fix Postgres migration when schema is not public. (#6340) --- .../ca/uhn/fhir/jpa/migrate/taskdef/DropPrimaryKeyTask.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hapi-fhir-sql-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropPrimaryKeyTask.java b/hapi-fhir-sql-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropPrimaryKeyTask.java index 1437a537308..e8a85034ec4 100644 --- a/hapi-fhir-sql-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropPrimaryKeyTask.java +++ b/hapi-fhir-sql-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropPrimaryKeyTask.java @@ -115,7 +115,7 @@ public class DropPrimaryKeyTask extends BaseTableTask { return null; // Irrelevant: We don't need to run the SQL for these databases. case POSTGRES_9_4: return "SELECT constraint_name " + "FROM information_schema.table_constraints " - + "WHERE table_schema = 'public' " + + "WHERE table_schema = coalesce(current_schema(), 'public') " + "AND constraint_type = 'PRIMARY KEY' " + "AND table_name = ?"; case ORACLE_12C: