ERROR: 5 values for 3 columns

Firebug

Not-so Great Engineer
Joined
Sep 25, 2014
Messages
1,271
Location
Clevedon, England
It doesn't tell me where in my mod this error is, not a clue. So what should i be looking for?
 
It doesn't tell me where in my mod this error is, not a clue. So what should i be looking for?
You can use the time stamps in the logs to reduce the scope of your search, for example

Got this in Database.log :
Code:
[2461825.012] [Gameplay] ERROR: table Colors has 6 columns but 5 values were supplied

Found that in Modding.log :
Code:
[2461824.980] Status: UpdateDatabase - Loading NewCityStates.sql
[2461825.012] Warning: UpdateDatabase - Error Loading SQL.
 
I was able to track the source of the issue to my AngloSaxon_GameDefines.sql file but sadly my lack of organisation has come back to bite me in the rear, because i can't find the error in the file for the death of me.
 
Last edited:
[2635082.416] [Gameplay] ERROR: 5 values for 3 columns
[2635082.606] [Gameplay]: Validating Foreign Key Constraints...
[2635082.630] [Gameplay]: Passed Validation.

[2635082.385] Status: UpdateDatabase - Loading Core/AngloSaxon_GameDefines.sql
[2635082.416] Warning: UpdateDatabase - Error Loading SQL.
[2635082.417] Status: UpdateDatabase - Loading Core/AngloSaxon_Uniques.xml

Here's the matching timestamp. At first i thought it was the Uniques.xml but it says Error Loading SQL.
 
Code:
--==========================================================================================================================
-- CIVILIZATIONS
--==========================================================================================================================
-- CivilizationLeaders
-------------------------------------   
INSERT INTO CivilizationLeaders 
        (CivilizationType,                      LeaderType,                         CapitalName)
SELECT  'CIVILIZATION_FB_ANGLO_SAXONS',         'LEADER_FB_OFFA',           'LOC_CITY_NAME_FB_TAMWORTH'
        'CIVILIZATION_FB_ANGLO_SAXONS',         'LEADER_FB_ALFRED',         'LOC_CITY_NAME_FB_WINCHESTER'
Appears to be the very bottom of the file.

Missing a comma "," at the end of the 1st SELECT line, and a ";" at the end of the chunk.

Since you don't seme to be extracting data from some other element in the database to use in the Insert you can also just as easily get rid of the SELECT statement and use VALUES in order to cure the current issue where your code chunk is being interpretted as an attempt to stick more columns into a single row that you have specified columns for data to be sent to. (ie, your code is treating the whole thing as written as an attempt to plop all that into a single row in the table CivilizationLeaders.)
Code:
INSERT INTO CivilizationLeaders 
        (CivilizationType,			LeaderType,		CapitalName)
VALUES  ('CIVILIZATION_FB_ANGLO_SAXONS',	'LEADER_FB_OFFA',	'LOC_CITY_NAME_FB_TAMWORTH'),
        ('CIVILIZATION_FB_ANGLO_SAXONS',	'LEADER_FB_ALFRED',	'LOC_CITY_NAME_FB_WINCHESTER');
 
Last edited:
BTW, an XML file would not normally throw that error. It would throw an error for "duplicate column names" or an error for "expected <Row> but got ......". And in most cases such an error in an xml file will also spit out an error line in the database log specifying the filename wherein the error was encountered. This is probably just about the only way xml is better than sql: syntax errors in xml files generally give much more information, including the filename.
 
That's fixed it, thanks a ton.
 
Back
Top Bottom