diff --git a/core/modules/pgsql/tests/src/Kernel/pgsql/NonPublicSchemaTest.php b/core/modules/pgsql/tests/src/Kernel/pgsql/NonPublicSchemaTest.php
index 10a69438e79842813e41f12352004ab7e7e85a70..f2295ff105760a38ab922807fba35dfae4b7733e 100644
--- a/core/modules/pgsql/tests/src/Kernel/pgsql/NonPublicSchemaTest.php
+++ b/core/modules/pgsql/tests/src/Kernel/pgsql/NonPublicSchemaTest.php
@@ -37,6 +37,7 @@ protected function setUp(): void {
     // Create a connection to the non-public schema.
     $info = Database::getConnectionInfo('default');
     $info['default']['schema'] = 'testing_fake';
+    Database::getConnection()->query('CREATE SCHEMA IF NOT EXISTS testing_fake');
     Database::addConnectionInfo('default', 'testing_fake', $info['default']);
 
     $this->testingFakeConnection = Database::getConnection('testing_fake', 'default');