# Fehlermeldung Migrations-Plugins. "Not unique table/alias: 'meta\_keyword'" Kann mir jemand helfen?

**URL:** <https://forum.shopware.com/t/fehlermeldung-migrations-plugins-not-unique-table-alias-meta-keyword-kann-mir-jemand-helfen/50665>\
**Category:** Plugins\
**Tags:** offizielle-shopware-\
**Created:** [25. Januar 2018 um 14:39 UTC](https://forum.shopware.com/t/fehlermeldung-migrations-plugins-not-unique-table-alias-meta-keyword-kann-mir-jemand-helfen/50665 "2018-01-25T14:39:02Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maximus100](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Maximus100](https://forum.shopware.com/u/Maximus100)\
**Post date:** [25. Januar 2018 um 14:39 UTC](https://forum.shopware.com/t/fehlermeldung-migrations-plugins-not-unique-table-alias-meta-keyword-kann-mir-jemand-helfen/50665/1 "2018-01-25T14:39:02Z")

</div>

Hallo ich versuche grad einen Magentoshop der Version 1.8.1.0 mithilfe des Migrations-Plugins von Shopware in einen Shopware Shop der Version 5.3.2 zu &nbsp;Migrieren. Das Mapping der Felder hat soweit gut geklappt. Ich erhalte aber kurz nach dem Start folgende fehlermeldung:

**Code** &nbsp;: 42000  
**Line** &nbsp;: 224  
**File** &nbsp;: /var/www/vhosts/lvps83-169-4-7.dedicated.hosteurope.de/httpdocs/engine/Library/Zend/Db/Statement/Pdo.php

**Error** &nbsp;: SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias: ‘meta\_keyword’

&nbsp;

Egal was ich migrieren will (Artikel oder nur Kunden) es kommt immer wieder dieser Fehler.

&nbsp;

Über hinweise würde ich mich freuen!

Danke

---

<div class="post-metadata">

**Author:** ![PStadtfeld](https://avatars.discourse-cdn.com/v4/letter/p/3bc359/32.png) [@PStadtfeld](https://forum.shopware.com/u/PStadtfeld)\
**Post date:** [25. Januar 2018 um 15:09 UTC](https://forum.shopware.com/t/fehlermeldung-migrations-plugins-not-unique-table-alias-meta-keyword-kann-mir-jemand-helfen/50665/2 "2018-01-25T15:09:43Z")

</div>

Klingt als würde eine Tabelle/Field als Alias “meta\_keyword” definiert werden, während im selben Statement bereits eine solch lautende Tabelle/Field verwendet wird…  
Oder es wird für eine Tabelle ein Alias vergeben, welcher dem akuten Tabellenname 1:1 entspricht, das mag SQL teils auch nicht.

Bekommst du das Statement heraus?

---

<div class="post-metadata">

**Author:** ![Maximus100](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Maximus100](https://forum.shopware.com/u/Maximus100)\
**Post date:** [25. Januar 2018 um 15:16 UTC](https://forum.shopware.com/t/fehlermeldung-migrations-plugins-not-unique-table-alias-meta-keyword-kann-mir-jemand-helfen/50665/3 "2018-01-25T15:16:06Z")

</div>

Hallo erstmal&nbsp;danke für die Antwort:&nbsp;

ich bin mir nicht sicher ob das weiter hilft, aber villeicht hat es hiermit etwas zu tun&nbsp;(aus der magento.php&nbsp;des Migrations Plugins):

```
 public function getProductSelect() { $attributes = ['description', 'name', 'short\_description', 'status', 'manufacturer', 'price', 'cost', 'tax\_class\_id', 'meta\_keyword', 'special\_price']; $custom\_select = ''; foreach ($this-\>getAttributes() as $attributeID =\> $attribute) { $custom\_select .= ", $attributeID.value as `$attributeID`"; $attributes[] = $attributeID; } $sql = " SELECT catalog\_product.entity\_id as productID, catalog\_product.sku as ordernumber, catalog\_product.created\_at as added, name.value as name, NULL as additionaltext, description.value as description\_long, short\_description.value as description, meta\_keyword.value as keywords, manufacturer\_option.value as supplier, cs.qty as instock, cs.min\_qty as stockmin, cs.min\_sale\_qty as minpurchase, cs.max\_sale\_qty as maxpurchase, tax\_class\_id.value as taxID, cost.value as baseprice, IFNULL(special\_price.value, price.value) as price, IF(special\_price.value IS NULL, 0, price.value) as pseudoprice $custom\_select FROM {$this-\>quoteTable('catalog\_product\_entity')} catalog\_product -- Joins the attribute tables {$this-\>createTableSelect('catalog\_product', $attributes, 0)} -- Join for instock LEFT JOIN {$this-\>quoteTable('cataloginventory\_stock\_item')} cs ON cs.`product_id`=catalog\_product.`entity_id` AND cs.`stock_id`=1 -- maps child articles to parents LEFT JOIN {$this-\>quoteTable('catalog\_product\_relation')} relation ON catalog\_product.entity\_id=relation.child\_id -- Joins the attribute values for the manufacturer LEFT JOIN {$this-\>quoteTable('eav\_attribute\_option\_value')} manufacturer\_option ON manufacturer\_option.option\_id=manufacturer.value -- Need to order by parent id in order to correctly assign children later ORDER BY relation.parent\_id ASC "; return $sql; }
```

---

<div class="post-metadata">

**Author:** ![PStadtfeld](https://avatars.discourse-cdn.com/v4/letter/p/3bc359/32.png) [@PStadtfeld](https://forum.shopware.com/u/PStadtfeld)\
**Post date:** [25. Januar 2018 um 15:24 UTC](https://forum.shopware.com/t/fehlermeldung-migrations-plugins-not-unique-table-alias-meta-keyword-kann-mir-jemand-helfen/50665/4 "2018-01-25T15:24:33Z")

</div>

Woah… okay, der Teil hier KÖNNTE das Problem sein:

```
   FROM {$this->quoteTable('catalog_product_entity')} catalog_product

   -- Joins the attribute tables
   {$this->createTableSelect('catalog_product', $attributes, 0)}

```

Kann nicht mit Bestimmtheit sagen, was er bei “$this-\>createTableSelect” macht, allerdings wird hier “catalog\_product” übergeben, welches bereits als Alias für catalog\_product\_entity verwendet wurde…

Ansonsten vielleicht mal über dem “return $sql;” ein "die(’

```
'.$sql.'

```

');" einbauen um zu schauen, wie das fertige Statement aussieht

---

<div class="post-metadata">

**Author:** ![Maximus100](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Maximus100](https://forum.shopware.com/u/Maximus100)\
**Post date:** [25. Januar 2018 um 15:31 UTC](https://forum.shopware.com/t/fehlermeldung-migrations-plugins-not-unique-table-alias-meta-keyword-kann-mir-jemand-helfen/50665/5 "2018-01-25T15:31:31Z")

</div>

Okay danke! leider verstehe ich noch nicht ganz aber hier nochmal die funktion createTableSelect:

&nbsp;

```
 /\*\* \* Returns the sql statement to select the shop system article attribute fields \* \* @param string $type \* @param null $attributes \* @param null $store\_id \* @param bool $full\_select \* @return string \*/ public function createTableSelect( $type = 'catalog\_product', $attributes = null, $store\_id = null, $full\_select = false ) { $sql = " SELECT ea.attribute\_code as `name`, ea.attribute\_id as `id`, ea.backend\_type as `type`, ea.is\_required as `required` FROM {$this-\>quoteTable('eav\_attribute')} ea, {$this-\>quoteTable('eav\_entity\_type')} et WHERE ea.`entity_type_id`=et.entity\_type\_id AND et.entity\_type\_code=? AND ea.frontend\_input!='' "; if (!empty($attributes)) { $sql .= 'AND ea.attribute\_code IN (' . $this-\>Db()-\>quote($attributes) . ')'; } else { $sql .= 'ORDER BY `required` DESC, `name`'; } $attribute\_fields = $this-\>Db()-\>fetchAssoc($sql, [$type]); if (empty($attributes)) { $attributes = array\_keys($attribute\_fields); } $select\_fields = []; $join\_fields = ''; // Do not use quoteTable for aliases! $type\_quoted = "`{$type}`"; foreach ($attributes as $attribute) { if (empty($attribute\_fields[$attribute])) { $join\_fields .= " LEFT JOIN (SELECT 1 as attribute\_id, NULL as value) as `$attribute` ON 1 "; } else { if ($attribute\_fields[$attribute]['type'] == 'static') { $select\_fields[] = "{$type\_quoted}.{$attribute}"; } else { $join\_fields .= " LEFT JOIN {$this-\>quoteTable($type.'\_entity\_'.$attribute\_fields[$attribute]['type'])} `$attribute` ON `{$attribute}`.attribute\_id = {$attribute\_fields[$attribute]['id']} AND `{$attribute}`.entity\_id = {$type\_quoted}.entity\_id "; if ($store\_id !== null) { $join\_fields .= " AND {$attribute\_fields[$attribute]['name']}.store\_id = {$this-\>Db()-\>quote($store\_id)} "; } $select\_fields[] = "{$attribute}.value as `{$attribute}`"; } } } if (!$full\_select) { return $join\_fields; } else { $select\_fields = implode(', ', $select\_fields); return " SELECT $select\_fields FROM {$this-\>quoteTable($type.'\_entity')} $type $join\_fields "; } } }
```

---

<div class="post-metadata">

**Author:** ![Maximus100](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Maximus100](https://forum.shopware.com/u/Maximus100)\
**Post date:** [25. Januar 2018 um 15:35 UTC](https://forum.shopware.com/t/fehlermeldung-migrations-plugins-not-unique-table-alias-meta-keyword-kann-mir-jemand-helfen/50665/6 "2018-01-25T15:35:00Z")

</div>

> [@PStadtfeld schrieb:](https://forum.shopware.com/profile/26941/PStadtfeld "PStadtfeld")
> 
> Ansonsten vielleicht mal über dem „return $sql;“ ein "die(’
> 
> ‚.$sql.‘
> 
> ');" einbauen um zu schauen, wie das fertige Statement aussieht

Danke für den Tip. Meinst du ausgeben lassen? Wie würde das aussehen? hab leider nicht soviel Ahnung davon…

---

<div class="post-metadata">

**Author:** ![PStadtfeld](https://avatars.discourse-cdn.com/v4/letter/p/3bc359/32.png) [@PStadtfeld](https://forum.shopware.com/u/PStadtfeld)\
**Post date:** [25. Januar 2018 um 15:49 UTC](https://forum.shopware.com/t/fehlermeldung-migrations-plugins-not-unique-table-alias-meta-keyword-kann-mir-jemand-helfen/50665/7 "2018-01-25T15:49:25Z")

</div>

Setz mal über das „return $sql“ folgende Zeile:

```
die(''.$sql.'');

```

Und ruf das nochmal auf, im besten Fall solltest du dann eine Ähnliche Ausgabe im Browserfenster bekommen mit dem gesamten Statement ohne Platzhalter, Variablen und Funktionen.

---

<div class="post-metadata">

**Author:** ![Maximus100](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Maximus100](https://forum.shopware.com/u/Maximus100)\
**Post date:** [25. Januar 2018 um 15:55 UTC](https://forum.shopware.com/t/fehlermeldung-migrations-plugins-not-unique-table-alias-meta-keyword-kann-mir-jemand-helfen/50665/8 "2018-01-25T15:55:36Z")

</div>

> [@PStadtfeld schrieb:](https://forum.shopware.com/profile/26941/PStadtfeld "PStadtfeld")
> 
> Setz mal über das „return $sql“ folgende Zeile:
> 
> die(‚‘.$sql.‚‘);
> 
> Und ruf das nochmal auf, im besten Fall solltest du dann eine Ähnliche Ausgabe im Browserfenster bekommen mit dem gesamten Statement ohne Platzhalter, Variablen und Funktionen.

Danke habe ich so gemacht. Leider bleibt der Vorgang stehen ohne das eine Ausgabe kommt. (Das Fenster des tools bleibt da nur der Import Ladebalken bleibt stehen… )&nbsp;&nbsp;

---

<div class="post-metadata">

**Author:** ![PStadtfeld](https://avatars.discourse-cdn.com/v4/letter/p/3bc359/32.png) [@PStadtfeld](https://forum.shopware.com/u/PStadtfeld)\
**Post date:** [25. Januar 2018 um 16:00 UTC](https://forum.shopware.com/t/fehlermeldung-migrations-plugins-not-unique-table-alias-meta-keyword-kann-mir-jemand-helfen/50665/9 "2018-01-25T16:00:33Z")

</div>

Blöd… Shopware hat Log-Befehle, mit denen KÖNNTE man versuchen das Statement in eine Log-Datei zu schreiben, aber da müsste ich nun selbst suchen… wie der PluginLogger nochmal richtig angesprochen wird …

Irgendwas wie:

```
 Shopware()-\>PluginLogger()-\>error($sql);

```

Da es sich hier aber scheinbar um ein Shopware-Eigenes Plugin handelt, müsstest du dich doch einfach an den Support direkt wenden können, oder? Das wäre vielleicht die einfachste Lösung, die haben das ja auch gebaut. Gehe davon aus, dass vielleicht eine deiner alten Tabellen so heisst wie eine Shopware-Tabelle oder so, aber alles bloss Vermutung an dieser Stelle…

&nbsp;

---

<div class="post-metadata">

**Author:** ![Maximus100](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Maximus100](https://forum.shopware.com/u/Maximus100)\
**Post date:** [25. Januar 2018 um 16:06 UTC](https://forum.shopware.com/t/fehlermeldung-migrations-plugins-not-unique-table-alias-meta-keyword-kann-mir-jemand-helfen/50665/10 "2018-01-25T16:06:26Z")

</div>

Ok danke ich werde nochmal schauen wie das Logging funktioniert und ggf. das Ergebnis hier Posten.

Den Support werde ich auch nochmal anschreiben.

&nbsp;

Vielen Dank für die Hilfe!

---

<div class="post-metadata">

**Author:** ![Maximus100](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Maximus100](https://forum.shopware.com/u/Maximus100)\
**Post date:** [25. Januar 2018 um 16:44 UTC](https://forum.shopware.com/t/fehlermeldung-migrations-plugins-not-unique-table-alias-meta-keyword-kann-mir-jemand-helfen/50665/11 "2018-01-25T16:44:30Z")

</div>

Shopware()-\>PluginLogger()-\>error($sql);

Ich habe nochmal nachgeschaut. Der befehl ist so richtig und schreibt das Statement in die Log Datei.&nbsp;

---

<div class="post-metadata">

**Author:** ![PStadtfeld](https://avatars.discourse-cdn.com/v4/letter/p/3bc359/32.png) [@PStadtfeld](https://forum.shopware.com/u/PStadtfeld)\
**Post date:** [26. Januar 2018 um 11:56 UTC](https://forum.shopware.com/t/fehlermeldung-migrations-plugins-not-unique-table-alias-meta-keyword-kann-mir-jemand-helfen/50665/12 "2018-01-26T11:56:33Z")

</div>

Hilft der Support weiter? Ansonsten kannst du mir die Log-Datei auch mal per PM schicken, dann seh ich mir das Statement an…

Die Frage ist dann nur, ob ich auf Anhieb das Problem auch finden würde und wie wir das im Plugin ordentlich beheben.

---

<div class="post-metadata">

**Author:** ![Moritz\_Naczenski](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/moritz_naczenski/32/7792_2.png) [@Moritz\_Naczenski](https://forum.shopware.com/u/Moritz_Naczenski)\
**Post date:** [26. Januar 2018 um 12:39 UTC](https://forum.shopware.com/t/fehlermeldung-migrations-plugins-not-unique-table-alias-meta-keyword-kann-mir-jemand-helfen/50665/13 "2018-01-26T12:39:11Z")

</div>

Also generell bieten wir keinen Support für das Plugin an, siehe den Hinweis im Store:&nbsp;[http://store.shopware.com/swag00426/migration-von-anderen-shopsystemen-zu-shopware.html](http://store.shopware.com/swag00426/migration-von-anderen-shopsystemen-zu-shopware.html)

Natürlich kann die Community hier unterstützen. Wenn du möchtest, kann ich auch einmal reinschauen, wenn du mir die Datenbank schickst würde ich das mal eben durchtesten. Hier einfach eine Mail an [forum@shopware.com](mailto:forum@shopware.com) schicken. Wenn es eine Kleinigkeit ist, sollte man das recht schnell finden. Versprechen, dass man es so gelöst bekommt, kann ich allerdings nicht.

---

<div class="post-metadata">

**Author:** ![Maximus100](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Maximus100](https://forum.shopware.com/u/Maximus100)\
**Post date:** [26. Januar 2018 um 13:32 UTC](https://forum.shopware.com/t/fehlermeldung-migrations-plugins-not-unique-table-alias-meta-keyword-kann-mir-jemand-helfen/50665/14 "2018-01-26T13:32:00Z")

</div>

> [@PStadtfeld schrieb:](https://forum.shopware.com/profile/26941/PStadtfeld "PStadtfeld")
> 
> Hilft der Support weiter? Ansonsten kannst du mir die Log-Datei auch mal per PM schicken, dann seh ich mir das Statement an…
> 
> Die Frage ist dann nur, ob ich auf Anhieb das Problem auch finden würde und wie wir das im Plugin ordentlich beheben.

Danke, habe das sql statement an dich gesendet.

---

<div class="post-metadata">

**Author:** ![Maximus100](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Maximus100](https://forum.shopware.com/u/Maximus100)\
**Post date:** [26. Januar 2018 um 13:33 UTC](https://forum.shopware.com/t/fehlermeldung-migrations-plugins-not-unique-table-alias-meta-keyword-kann-mir-jemand-helfen/50665/15 "2018-01-26T13:33:25Z")

</div>

> [@Moritz Naczenski schrieb:](https://forum.shopware.com/profile/14574/Moritz%20Naczenski "Moritz%20Naczenski")
> 
> Also generell bieten wir keinen Support für das Plugin an, siehe den Hinweis im Store:&nbsp;[http://store.shopware.com/swag00426/migration-von-anderen-shopsystemen-zu-shopware.html](http://store.shopware.com/swag00426/migration-von-anderen-shopsystemen-zu-shopware.html)
> 
> Natürlich kann die Community hier unterstützen. Wenn du möchtest, kann ich auch einmal reinschauen, wenn du mir die Datenbank schickst würde ich das mal eben durchtesten. Hier einfach eine Mail an [forum@shopware.com](mailto:forum@shopware.com) schicken. Wenn es eine Kleinigkeit ist, sollte man das recht schnell finden. Versprechen, dass man es so gelöst bekommt, kann ich allerdings nicht.

Danke! Habe grade an die Emailadresse gesendet.&nbsp;

---

<div class="post-metadata">

**Author:** ![PStadtfeld](https://avatars.discourse-cdn.com/v4/letter/p/3bc359/32.png) [@PStadtfeld](https://forum.shopware.com/u/PStadtfeld)\
**Post date:** [26. Januar 2018 um 13:51 UTC](https://forum.shopware.com/t/fehlermeldung-migrations-plugins-not-unique-table-alias-meta-keyword-kann-mir-jemand-helfen/50665/16 "2018-01-26T13:51:44Z")

</div>

Haben den Fehler nun hoffentlich gefunden, eine Tabelle scheint doppelt gejoint worden zu sein, nämlich „meta\_keyword“, dass er dann meckert ist klar 😃

---

<div class="post-metadata">

**Author:** ![Maximus100](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Maximus100](https://forum.shopware.com/u/Maximus100)\
**Post date:** [26. Januar 2018 um 14:30 UTC](https://forum.shopware.com/t/fehlermeldung-migrations-plugins-not-unique-table-alias-meta-keyword-kann-mir-jemand-helfen/50665/17 "2018-01-26T14:30:59Z")

</div>

Danke damit bin ich der Lösung schon einen entscheidenen Schritt näher. D.h in der Funktion&nbsp;createTableSelect() (oben schoneinmal gepostet) des Migrations Plugins (magento.php) müsste ein Fehler sein?!

Habt ihr eine Idee warum diese Funktion einen fehlerhaften SELECT zurück gibt?&nbsp;
