--- 1060476-167.patch 2023-03-23 10:51:21.000000000 +0530 +++ 1060476-171.patch 2023-03-23 11:03:39.000000000 +0530 @@ -1,8 +1,8 @@ diff --git a/core/lib/Drupal/Core/Database/Connection.php b/core/lib/Drupal/Core/Database/Connection.php -index b6f7968dcf8..d35516d7369 100644 +index 2bb3c057b4..7e405e1b1b 100644 --- a/core/lib/Drupal/Core/Database/Connection.php +++ b/core/lib/Drupal/Core/Database/Connection.php -@@ -114,7 +114,7 @@ abstract class Connection { +@@ -116,7 +116,7 @@ abstract class Connection { * * @var string */ @@ -11,7 +11,7 @@ /** * Replacements to fully qualify {table} placeholders in SQL strings. -@@ -124,7 +124,7 @@ abstract class Connection { +@@ -126,7 +126,7 @@ abstract class Connection { * * @var string[] */ @@ -21,7 +21,7 @@ /** * The prefixes used by this database connection. diff --git a/core/modules/pgsql/src/Driver/Database/pgsql/Connection.php b/core/modules/pgsql/src/Driver/Database/pgsql/Connection.php -index 8417ed831be..68860a3239f 100644 +index c5d53e29f1..fd5a71bf4b 100644 --- a/core/modules/pgsql/src/Driver/Database/pgsql/Connection.php +++ b/core/modules/pgsql/src/Driver/Database/pgsql/Connection.php @@ -73,6 +73,10 @@ class Connection extends DatabaseConnection implements SupportsTemporaryTablesIn @@ -80,7 +80,7 @@ /** diff --git a/core/modules/pgsql/src/Driver/Database/pgsql/Schema.php b/core/modules/pgsql/src/Driver/Database/pgsql/Schema.php -index 2336d103fa9..572628193d7 100644 +index 5c3052e56a..c164b1f09a 100644 --- a/core/modules/pgsql/src/Driver/Database/pgsql/Schema.php +++ b/core/modules/pgsql/src/Driver/Database/pgsql/Schema.php @@ -50,6 +50,18 @@ class Schema extends DatabaseSchema { @@ -112,7 +112,7 @@ // Take into account that temporary tables are stored in a different schema. // \Drupal\Core\Database\Connection::generateTemporaryTableName() sets the // 'db_temporary_' prefix to all temporary tables. -- if (strpos($key, '.') === FALSE && strpos($table, 'db_temporary_') === FALSE) { +- if (!str_contains($key, '.') && !str_contains($table, 'db_temporary_')) { - $key = 'public.' . $key; + if (strpos($table, 'db_temporary_') !== FALSE) { + $key = $quoted_key = $this->getTempNamespaceName() . '.' . $prefixed_table; @@ -138,7 +138,7 @@ */ protected function resetTableInformation($table) { - $key = $this->connection->prefixTables('{' . $table . '}'); -- if (strpos($key, '.') === FALSE) { +- if (!str_contains($key, '.')) { - $key = 'public.' . $key; - } + $key = $this->defaultSchema . '.' . $this->connection->getPrefix() . $table; @@ -191,7 +191,7 @@ // clause and not used as an identifier. $index_name = str_replace('"', '', $index_name); - return (bool) $this->connection->query("SELECT 1 FROM pg_indexes WHERE indexname = '$index_name'")->fetchField(); -+ ++ + $sql_params = [ + ':schema' => $this->defaultSchema, + ':table' => $this->connection->getPrefix() . $table, @@ -212,7 +212,7 @@ } diff --git a/core/modules/pgsql/tests/src/Kernel/pgsql/NonPublicSchemaTest.php b/core/modules/pgsql/tests/src/Kernel/pgsql/NonPublicSchemaTest.php new file mode 100644 -index 00000000000..731a3053f2f +index 0000000000..731a3053f2 --- /dev/null +++ b/core/modules/pgsql/tests/src/Kernel/pgsql/NonPublicSchemaTest.php @@ -0,0 +1,361 @@