This relates to gmap_taxonomy.module
Steps to reproduce:
- Install gmap 7.x-2.x dev and enable gmap, gmap_taxonomy, views
- Create a taxonomy that enables multiple terms and add two terms to it. Set a different marker for the two terms
- Add a node and select both tags for this node.
Error displayed:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '8' for key 'PRIMARY': INSERT INTO {gmap_taxonomy_node} (nid, tid, marker) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 8 [:db_insert_placeholder_1] => 3 [:db_insert_placeholder_2] => purple ) in gmap_taxonomy_node_update() (line 190 of /var/www/xxx/sites/all/modules/gmap/gmap_taxonomy.module).
The issue is in gmap_taxonomy.module, where it tries to add a row in gmap_taxonomy_node for each tag.
178 // Otherwise loop through and set marker for term, if term has marker
179 foreach ($terms as $term) {
Not sure if the desired behavior is to store/display one marker per node or multiple, but right now the table schema is made for one and the code is made for the other.
Comments
Comment #1
GolDRoger commentedSame problem happens to me, any idea how to solve this?
Comment #2
amcc commentedsame issue for me - have a taxonomy on a node that enables multiple selection as above
Comment #3
bewhy commentedI'm experiencing this problem. My solution was to only add markers for 1st level terms, not 2nd level terms (I had to go into the database and delete the unwanted ones manually). I know that this assumes that the taxonomy has a hierarchy and only some terms having a marker type.
If you want multiple tags for multiple markers, what decides which markers to display? AFter all, there's only one marker on the map per location.
I think the middle-road is for the code to select the taxonomy term with the 'lightest weight', assuming that taxonomy terms have weights in the first place. Another option (if you have a hierarchy) is that you only add the markers for taxonomy terms that have no parent.
forgot to put in my deets:
gmap 7.x-2.8
location 7.x-3.0-rc6
Comment #4
FuXXz commentedwhy the errors are ignored for years?
Comment #5
dan1eln1el5en commentedalso interested in a fix for this.
Comment #6
cossme commentedhere is quick patch that solves the issue: add a break in line 209 of gmap_taxonomy.module file
[edit] sorry, I was to fast: in order to get this to work you also need to drop the column "vid" in gmap_taxonomy_node - that column and the fact that it was removed from the schema without actually dropping it from the table is the true cause of the error. [/edit]
Comment #7
thomas.frobieterPatch #6 works great for me!
Comment #8
anybody-- unwanted double posting TO BE REMOVED --
Comment #9
anybodyI can confirm the patch works and is logically okay. Please remove the unnecessary comments from the patch when applying it against the dev release.
This should be fixed ASAP, because the problem leads to a database error. Thanks a lot for your good work. Setting this RTBC.
Comment #11
anpolimusIf we want to fix this problem, we have to add delta field to the mysql table.
@podarok - can I do this here?
Comment #12
podarok@anpolimus this sounds like feature request, not a bug report
Comment #13
anybodyThe issue is still open and leads to errors... please help! It's RTBC!
Comment #14
podarokPatch can't be applied. Needs reroll
Comment #15
anybodyReroll
Comment #17
anybodyReroll 2
Comment #19
anybodySorry. Here's the hopefully final one that works.
Comment #20
anybodyComment #21
anybodyComment #22
anybody#19 is RTBC.
@Module maintainer: Please apply and add to the next stable release. This bug is really disturbing.
Comment #23
podarok#19 is merged
Thanks
Comment #24
podarokadded upport issue https://github.com/drupal-ukraine/dmaps/issues/77
Comment #27
infopicard commentedI would like to reopen this issue - because I use the current gmap version 7.x-2.11 with has included the patch mentioned here in this threat.
but if I edit an existing node and klick on save, I get the same error message :-(
I have only one marker related to on taxonomy term and only one taxonomy entry related to a node. ok, there are several vocabulary connected to the content type but only one taxonomy is relevant for the marker type.
my site is a migrated D6 site - the D6 site works without problems.
I use GMAP and LOCATION modules to store geodata to Node Locations in D7 because of migration from D6.
I have several problems to make the migration work under D7 (unfortunately not D8 because of missing a lot of Modules in D8, especially GMAP and LOCATION :-( )
I need urgent help on this issue - anybody an idea?