1062 Duplicate entry 'Customers who have never...
I'm trying to upgrade to 1.3.8a and when I click database upgrade I got the following message:
HTML Code:
1062 Duplicate entry 'Customers who have never completed a purchase' for key 2
in:
[INSERT INTO query_builder (query_category, query_name, query_description , query_string) VALUES ('email,newsletters', 'Customers who have never completed a purchase', 'For sending newsletter to all customers who registered but have never completed a purchase', 'SELECT DISTINCT c.customers_email_address as customers_email_address, c.customers_lastname as customers_lastname, c.customers_firstname as customers_firstname FROM TABLE_CUSTOMERS c LEFT JOIN TABLE_ORDERS o ON c.customers_id=o.customers_id WHERE o.date_purchased IS NULL');]
As I guess the matter was in (.) in between 'c' and 'LEFT'. Is it right (means bug) ?
If so where it can be changed?
If not what should I do next?
Thank you
Re: 1062 Duplicate entry 'Customers who have never...
Quote:
Originally Posted by
LostSheep
As I guess the matter was in (.) in between 'c' and 'LEFT'. Is it right (means bug) ?
No, it's not a bug.
It's trying to insert a record that apparently already exists.
Did you run the database upgrade twice for some reason?
Re: 1062 Duplicate entry 'Customers who have never...
Run this using the SQL Patch tool in the Admin->Tools menu:
Code:
DELETE from query_builder where query_name = 'Customers who have never completed a purchase';
Then you should be able to redo the database upgrade ... again.
Re: 1062 Duplicate entry 'Customers who have never...
Thanks DrByte for this little tip as I inadvertantly downgraded my DB Patch to 1.3.7 and couldn't get the db upgrade to allow 1.3.7 -> 1.3.8a...
After the SQL execution, re-run the upgrade and all is well ! ! !
Many Thanks again !
Jim
Re: 1062 Duplicate entry 'Customers who have never...
I keep getting this error too. I have gone to my admin and entered: SQL Query delete portion and I have even done a fresh install of my database but no luck!
I have been workin on this for 2 days now and very very frustrated at this point.
1062 Duplicate entry 'Customers who have never completed a purchase' for key 2
in:
[INSERT INTO zen_query_builder (query_category, query_name, query_description , query_string) VALUES ('email,newsletters', 'Customers who have never completed a purchase', 'For sending newsletter to all customers who registered but have never completed a purchase', 'SELECT DISTINCT c.customers_email_address as customers_email_address, c.customers_lastname as customers_lastname, c.customers_firstname as customers_firstname FROM TABLE_CUSTOMERS c LEFT JOIN TABLE_ORDERS o ON c.customers_id=o.customers_id WHERE o.date_purchased IS NULL');]
Re: 1062 Duplicate entry 'Customers who have never...
Quote:
Originally Posted by
travel124
I keep getting this error too. I have gone to my admin and entered: SQL Query delete portion and I have even done a fresh install of my database but no luck!
Then maybe you're hitting the wrong database or table?
Quote:
Originally Posted by
travel124
[INSERT INTO zen_query_builder ...
If you've deleted the entry, but it keeps saying it exists, then you're probably not deleting it from the right place.
The upgrader will only attempt to run that INSERT command when you do the 1.3.7-to-1.3.8 upgrade step.
If you've already done that step once, then naturally it would be expected that it would croak.
If you are certain you've done everything correctly and don't care about that particular statement, edit the /zc_install/sql/mysql_zencart_upgrade_137_to_138.sql file and put a # at the beginning of that line to comment it out.
Then cross your fingers when you run that upgrade step again.
Re: 1062 Duplicate entry 'Customers who have never...
I am fine now.
Thanks for your help!
New issue with admin here: http://www.zen-cart.com/forum/showthread.php?t=84655
Re: 1062 Duplicate entry 'Customers who have never...
I really do try not to tag on to threads with such good documentation.. but I can't make it work. I keep trying what I find here on he boards but to no resolve. So with my deepest apologies can someone please have a look at my work and help me find some more things to try.
The problems I am having.
Can't Log in to my cart
1062 Dup error.. can't upgrade cart to 1.38a
Info:
https://store.angeleyes.org/
I am trying to upgrade from 1.3.8 to 1.3.8a to fix the "can't log in to my cart problem.
Error code:
Error There was a security error when trying to login.
Error code:
1062 Duplicate entry 'Customers who have never completed a purchase' for key 2
in:
[INSERT INTO zenquery_builder (query_category, query_name, query_description , query_string) VALUES ('email,newsletters', 'Customers who have never completed a purchase', 'For sending newsletter to all customers who registered but have never completed a purchase', 'SELECT DISTINCT c.customers_email_address as customers_email_address, c.customers_lastname as customers_lastname, c.customers_firstname as customers_firstname FROM TABLE_CUSTOMERS c LEFT JOIN TABLE_ORDERS o ON c.customers_id=o.customers_id WHERE o.date_purchased IS NULL');]
Any help is very appreciated.. DrByte, looks like you help more people that Red Cross does.. once I get this thing working you get a Gift Certificate in appreciation. Dubious prize I know, but its just a token of appreciation.
Cam
Rj Dollen
Re: 1062 Duplicate entry 'Customers who have never...
Another approach you can try is to add a # before the INSERT statement mentioned ... which will cause it not to be processed.
Re: 1062 Duplicate entry 'Customers who have never...
Quote:
Originally Posted by
DrByte
Another approach you can try is to add a # before the INSERT statement mentioned ... which will cause it not to be processed.
I am shamed a little here to say.. I have no idea what to do with that chuck of code.. the "[INSERT INTO zen_query_builder (...." bit is a mystery to me.
So "#[INSERT INTO zen_query_builder (...." goes where?
Cam
Re: 1062 Duplicate entry 'Customers who have never...
Re: 1062 Duplicate entry 'Customers who have never...
I wish I could report great success here. Its just not working and the best I can tell.. it should be. :frusty: Tell me this DrByte... are you for hire?
I am starting to think that restoring an older version of the database and redoing some work might be easier. I do still have a payment module to drop into this if I can ever get it working.
Re: 1062 Duplicate entry 'Customers who have never...
You did do full backups before upgrading, right?
Re: 1062 Duplicate entry 'Customers who have never...
I use Dreamhost and they do it every 12 hours or so. I am pretty sure I can restore. Not positive. But I think so. I know I am dangerous with my limited knowledge here but here is the plan in my head:
Restore the DB
Copy all the files from the server (Zen Cart Files) that I used before the upgrades
See how far back I am with my products, customizations and such.
Once I have it all working again I have a Payment module to dump in from Transfirst.com
That and a Fat Tire (beer)
Cam
Re: 1062 Duplicate entry 'Customers who have never...
Hi,
So with a clearer mind and a rejuvenated will I am back. Here is the current state of my cart:
My problems started after I ran the 1.3.8a update.
I installed my Transfirst.com merchant model (just released for 1.3.8a)
Then when I went to test it I could not log-in. I was getting a Security error. Something to the similar to "There was a security Error" in a red box above the log-in fields.
I ran this "DELETE from query_builder where query_name = 'Customers who have never completed a purchase';" so that I could re-run the install.
Ran the install with this error:
"1062 Duplicate entry 'Customers who have never completed a purchase' for key 2
in:
[INSERT INTO zenquery_builder (query_category, query_name, query_description , query_string) VALUES ('email,newsletters', 'Customers who have never completed a purchase', 'For sending newsletter to all customers who registered but have never completed a purchase', 'SELECT DISTINCT c.customers_email_address as customers_email_address, c.customers_lastname as customers_lastname, c.customers_firstname as customers_firstname FROM TABLE_CUSTOMERS c LEFT JOIN TABLE_ORDERS o ON c.customers_id=o.customers_id WHERE o.date_purchased IS NULL');]"
Then I put a # in front of the "INSERT INTO " in the /zc_install/sql/mysql_upgrade_137_to_138.sql file
which brings me to where I am now:
I have backed up the files on my server both before and after the upgrade attempt.
My DB backs up automatically and can be restored in 12 hour chunks
I have debated restoring and copying the old files over, then trying a reinstall but don't know if that is a doable option or if I will mess stuff up doing it.
What I need to fix right now:
customers can not register for an account.. it just loops back to the same page with no errors.
Existing customers: me, can not login
Other notes that might be helpful:
This is not really live yet. There are not customers to save or data for them that I can not put back.
I would really like to keep all the products, attributes, customizations to the template and custom verbiage I have added.
Can anyone make sense of this predicament?
Thanks, Cam
Re: 1062 Duplicate entry 'Customers who have never...
Quote:
Originally Posted by
dollen
My problems started after I ran the 1.3.8a update.
If that "update" didn't include upgrading not only your database but also all your PHP files (both core and overrides), then you'll have various unexplainable problems ... curable only by properly completing both halves of the upgrade.