diff -u b/core/modules/pgsql/src/Driver/Database/pgsql/Schema.php b/core/modules/pgsql/src/Driver/Database/pgsql/Schema.php --- b/core/modules/pgsql/src/Driver/Database/pgsql/Schema.php +++ b/core/modules/pgsql/src/Driver/Database/pgsql/Schema.php @@ -127,17 +127,22 @@ */ public function queryTableInformation($table) { // Generate a key to reference this table's information on. - $key = '"' . $this->connection->getPrefix() . $table . '"'; + $prefixed_table = $this->connection->getPrefix() . $table; // 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($table, 'db_temporary_') !== FALSE) { - $key = $this->getTempNamespaceName() . '.' . $key; + $key = $quoted_key = $this->getTempNamespaceName() . '.' . $prefixed_table; } elseif ($this->defaultSchema != 'public') { - $key = '"' . $this->defaultSchema . '".' . $key; + $key = $this->defaultSchema . '.' . $prefixed_table; + $quoted_key = '"' . $this->defaultSchema . '"."' . $prefixed_table . '"'; } + else { + $key = $this->defaultSchema . '.' . $prefixed_table; + $quoted_key = '"' . $prefixed_table . '"'; + } if (!isset($this->tableInformation[$key])) { $table_information = (object) [ @@ -164,7 +169,7 @@ OR pg_get_expr(pg_attrdef.adbin, pg_attribute.attrelid) LIKE 'nextval%') EOD; $result = $this->connection->query($sql, [ - ':key' => $key, + ':key' => $quoted_key, ]); } catch (\Exception $e) {