Zen Cart Logo
Forums / Bug Reports / ERROR: Cannot insert configuration_key "" because it already exists, empty db key

ERROR: Cannot insert configuration_key "" because it already exists, empty db key

Views: 2,846

Results 1 to 6 of 6
13 Mar 2015, 9:25 AM
#1
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,872
Plugin Contributions:
7

ERROR: Cannot insert configuration_key "" because it already exists, empty db key

In the SQL patch tool, I get the error "ERROR: Cannot insert configuration_key "" because it already exists", with perfectly valid SQL.

In the configuration table, there is an record with a configuration_title "Installed Modules" which has an empty configuration_key.
If I delete this record or put any value in its configuration_key, the SQL patch tool will process the sql happily.

This record is inserted by admin/modules.php, I believe related to the install/uninstall of ZC internal modules (payment, shipping etc.).

I know I have previously commented on this and deleted the empty entry but is has re-appeared so there is something that requires investigation, whether its the creation of this incomplete record or the behaviour of the SQL tool.

13 Mar 2015, 6:21 PM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: ERROR: Cannot insert configuration_key "" because it already exists, empty db key

torvista:

with perfectly valid SQL.
Can you share the specific SQL statement?

I'm guessing there's a conflict in how it's getting parsed, so knowing exactly what you're submitting will help in determining a fix.

(It shouldn't matter whether there's an existing blank key already in the db. That's not the issue.)

13 Mar 2015, 10:00 PM
#4
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,872
Plugin Contributions:
7

Re: ERROR: Cannot insert configuration_key "" because it already exists, empty db key

here is one

INSERT INTO configuration ( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, use_function, set_function ) VALUES
( 'User Tracking for Catalog Enabled', 'USER_TRACKING_CONFIG_ENABLED', 'true', 'Enable catalog user tracking (each click will be logged)?', 100, 1, NOW(), NULL, 'zen_cfg_select_option(array(''true'', ''false''),' );

13 Mar 2015, 10:25 PM
#5
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: ERROR: Cannot insert configuration_key "" because it already exists, empty db key

torvista:

here is one
Worked as provided on a zc 1.5.4 install that has Stock by attributes only installed, default template. No error message. Confirmed by going to configuration panel and changing gID to 100, one item in list.

13 Mar 2015, 11:28 PM
#6
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,872
Plugin Contributions:
7

Re: ERROR: Cannot insert configuration_key "" because it already exists, empty db key

yes, it does work...unless there is an unrelated record in the configuration table with an empty configuration_key.

There should not be a record in the configuration table with an empty configuration_key, but there is, as detailed in my first post.

So firstly, SQL tool should not choke on the query because of an unrelated empty field and secondly, how does an empty field get inserted by modules.php?

So maybe there are two bugs here...