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,874

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,876
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.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

13 Mar 2015, 11:05 AM
#2
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

To help out: previously identified at: http://www.zen-cart.com/showthread.php?210204-Cannot-insert-configuration_key-quot-quot-because-it-already-exists&p=1233704#post1233704

That thread references this one per torvista's follow-on search and identification.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

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

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

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.)

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

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

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
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''),' );

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

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.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

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

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
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...

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...