Skip to content

Commit a1f1ee3

Browse files
committed
Removed TABLESPACE definition from CREATE TEMPORARY TABLE to not conflict with MySQL 8
1 parent c47f5c5 commit a1f1ee3

File tree

1 file changed

+4
-2
lines changed
  • lib/internal/Magento/Framework/DB/Adapter/Pdo

1 file changed

+4
-2
lines changed

lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2236,8 +2236,10 @@ public function createTemporaryTableLike($temporaryTableName, $originTableName,
22362236
$ifNotExistsSql = ($ifNotExists ? ' IF NOT EXISTS' : '');
22372237
$temporaryTable = $this->quoteIdentifier($this->_getTableName($temporaryTableName));
22382238
$originTable = $this->quoteIdentifier($this->_getTableName($originTableName));
2239-
$originCreate = $this->fetchPairs(sprintf('SHOW CREATE TABLE %s', $originTable));
2240-
$sql = str_replace('CREATE TABLE', 'CREATE TEMPORARY TABLE' . $ifNotExistsSql, reset($originCreate));
2239+
$originCreate = $this->fetchPairs("SHOW CREATE TABLE {$originTable}");
2240+
$sql = reset($originCreate);
2241+
$sql = preg_replace('/\/\*!50100 TABLESPACE [^\s]+ \*\//', '', $sql);
2242+
$sql = str_replace('CREATE TABLE', 'CREATE TEMPORARY TABLE' . $ifNotExistsSql, $sql);
22412243
$sql = str_replace($originTable, $temporaryTable, $sql);
22422244

22432245
return $this->query($sql);

0 commit comments

Comments
 (0)