Skip to content

Multiple sql errors and rca when copying sql file #12

Description

when copying sql file to newer azerothcore builds it breaks with ERROR 1054 (42S22) at line 23: Unknown column 'id' in 'where clause'

sql command:
mysql -u root -p acore_world < ~/azerothcore-wotlk/modules/mod-assistant/data/sql/db-world/mod_assistant.sql

results:
ERROR 1054 (42S22) at line 23: Unknown column 'id' in 'where clause'


To resolve:
nano ~/azerothcore-wotlk/modules/mod-assistant/data/sql/db-world/mod_assistant.sql
Jump to line 23:
Change from:
DELETE FROM creature WHERE id=@entry;
To:
DELETE FROM creature WHERE id1=@entry;


NOTE: if you already tried to copy the sql file you will need to remove the partial entries from database

USE acore_world;
DELETE FROM creature WHERE guid = 9000000;
DELETE FROM creature_template WHERE entry = 9000000;
DELETE FROM creature_template_model WHERE CreatureID = 9000000;
SELECT COUNT() FROM creature WHERE guid = 9000000;
SELECT COUNT(
) FROM creature_template WHERE entry = 9000000;
SELECT COUNT(*) FROM creature_template_model WHERE CreatureID = 9000000;
exit;


Note: there is also a change required at line 24 due to error:
"ERROR 1062 (23000) at line 24: Duplicate entry '9000000' for key 'creature. PRIMARY'"

nano ~/azerothcore-wotlk/modules/mod-assistant/data/sql/db-world/mod_assistant.sql
Jump to line 24:
Change from:
INSERT INTO creature (id, map, position_x, position_y, position_z, orientation) VALUES
To:
INSERT INTO creature (id1, map, position_x, position_y, position_z, orientation) VALUES


Note: also reported was a trailing space before "$ ;" breaking sql parse via:
cat -A ~/azerothcore-wotlk/modules/mod-assistant/data/sql/db-world/mod_assistant.sql | head -25
example:
DELETE FROM 'creature' WHERE guid=@entry; $
There's a trailing space after the semicolon — ; $ instead of ;$. MySQL treats this as part of the statement in some contexts, but more importantly the line directly after it shows:
position_x', position_y', position_z', 'orientation') VALUES$
The INSERT INTO 'creature' and the opening ( with column names got separated — the INSERT statement is split across lines in a way that's breaking the parser. The column list opener is missing from what follows the INSERT line.

Fix:
sed -i 's/[[:space:]]*$//' ~/azerothcore-wotlk/modules/mod-assistant/data/sql/db-world/mod_assistant.sql

reissue the sql command
mysql -u root -p acore_world < ~/azerothcore-wotlk/modules/mod-assistant/data/sql/db-world/mod_assistant.sql
and it should return with no dialogue / successfully

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions