Cannot Save anything, error about duplicate entries
| Project: | Views |
| Version: | 6.x-2.x-dev |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
I'm getting an unusual error today, and I'm not sure what is causing it. I upgraded to the latest dev version of 6.x-2.x, but it continues. I noticed it when I went to save a View I was working on, and it took me to a Page not found error. If I refreshed from there, it returned me to the unsaved View. I was able to clone a view however. Here are the two errors that appear to be showing up in my log when this happened:
Type php
Date Saturday, November 14, 2009 - 13:02
User Webbstre
Location http://www.runicgamesfansite.com/torchlightmods/admin/build/views/edit/m...
Referrer http://www.runicgamesfansite.com/torchlightmods/admin/build/views/edit/m...
Message Duplicate entry 'most_downloaded' for key 2 query: INSERT INTO drupal1_views_view (name, description, tag, view_php, base_table, is_cacheable) VALUES ('most_downloaded', 'The most downloaded files', 'default', '', 'node', 0) in /home/runic0/runicgamesfansite.com/torchlightmods/sites/all/modules/views/includes/view.inc on line 1709.
Severity error
Hostname 122.31.37.167
Operations
Type php
Date Saturday, November 14, 2009 - 11:46
User Webbstre
Location http://www.runicgamesfansite.com/torchlightmods/admin/build/views/edit/m...
Referrer http://www.runicgamesfansite.com/torchlightmods/admin/build/views/edit/m...
Message Duplicate entry 'most_downloaded' for key 2 query: INSERT INTO drupal1_views_view (name, description, tag, view_php, base_table, is_cacheable) VALUES ('most_downloaded', 'The most downloaded files', 'default', '', 'node', 0) in /home/runic0/runicgamesfansite.com/torchlightmods/sites/all/modules/views/includes/view.inc on line 1702.
Severity error
Hostname 122.31.37.167
Operations
I marked this as critical because it has effectively halted me from making any progress. If you need any more information, just let me know. Thanks!

#1
have you inspected your database tables for any issues that need repair?
Moving to support request as I can't recreate this issue on any of my sites.
#2
Apparently it is trying to do an insert when the data already exists with the exact same values:
mysql> describe drupal1_views_view;
+--------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+------------------+------+-----+---------+----------------+
| vid | int(10) unsigned | NO | PRI | NULL | auto_increment |
| name | varchar(32) | NO | UNI | | |
| description | varchar(255) | YES | | | |
| tag | varchar(255) | YES | | | |
| view_php | blob | YES | | NULL | |
| base_table | varchar(64) | NO | | | |
| is_cacheable | tinyint(4) | YES | | 0 | |
+--------------+------------------+------+-----+---------+----------------+
7 rows in set (0.03 sec)
mysql> select * from drupal1_views_view where name = 'most_downloaded';
+-----+-----------------+---------------------------+---------+----------+------------+--------------+
| vid | name | description | tag | view_php | base_table | is_cacheable |
+-----+-----------------+---------------------------+---------+----------+------------+--------------+
| 32 | most_downloaded | The most downloaded files | default | | node | 0 |
+-----+-----------------+---------------------------+---------+----------+------------+--------------+
1 row in set (0.02 sec)
mysql>
Any clues?
#3
Hm. As a quick fix you can probably export your view (to ensure you still have a copy) and manually delete it from the database. Be sure to get the 'vid' of the view and delete all of the views_display records associated with it as well.
#4
When I went to delete the view I was working on, it deleted it, but also took me to another Page not Found error. I'm beginning to think this is something bigger than Views, but is only showing up so far when I do certain admin things. I'm going to have to keep looking into this to find what the problem is.
#5
The error appears to have been the result of some bad caching I think. It has disappeared as mysteriously as it appeared.
#6
Automatically closed -- issue fixed for 2 weeks with no activity.