Duplicate entry '5-43146-17874-5' for key 'PRIMARY' [1062]

Get help with installation and running phpBB 3.3.x here. Please do not post bug reports, feature requests, or extension related questions here.
Post Reply
Steve Appleton
Registered User
Posts: 13
Joined: Fri Mar 13, 2009 10:31 am
Location: Johannesburg South Africa
Name: Steve Appleton

Duplicate entry '5-43146-17874-5' for key 'PRIMARY' [1062]

Post by Steve Appleton »

The Forum intermittently gives the following error when posting a "reply" to a topic. The reply actually does get posted, but the error message makes it seem that it has not.
The BB creates a SQL string to insert the data into the notifications table twice. Because the key is unique, mysql naturally generates the error message. Question is why is the notification table entry being duplicated? Is there possibly a problem with some entry or other data in the database which was upgraded from an old version (3.1.9).
Thanks in advance for any pointers, Steve.

PHPBB version: 3.3.2
PHP version: 7.4.11

Code: Select all

General Error
SQL ERROR [ mysqli ]

Duplicate entry '5-43094-17874-3' for key 'PRIMARY' [1062]

SQL

INSERT INTO phpbb_notification_emails (item_id, notification_type_id, item_parent_id, user_id) VALUES (43094, 5, 17874, 3), (43094, 5, 17874, 3)

BACKTRACE

FILE: (not given by php)
LINE: (not given by php)
CALL: msg_handler()

FILE: [ROOT]/phpbb/db/driver/driver.php
LINE: 1023
CALL: trigger_error()

FILE: [ROOT]/phpbb/db/driver/mysqli.php
LINE: 195
CALL: phpbb\db\driver\driver->sql_error()

FILE: [ROOT]/phpbb/db/driver/driver.php
LINE: 682
CALL: phpbb\db\driver\mysqli->sql_query()

FILE: [ROOT]/phpbb/db/driver/factory.php
LINE: 393
CALL: phpbb\db\driver\driver->sql_multi_insert()

FILE: [ROOT]/phpbb/db/sql_insert_buffer.php
LINE: 138
CALL: phpbb\db\driver\factory->sql_multi_insert()

FILE: [ROOT]/phpbb/notification/method/email.php
LINE: 118
CALL: phpbb\db\sql_insert_buffer->flush()

FILE: [ROOT]/phpbb/notification/manager.php
LINE: 403
CALL: phpbb\notification\method\email->notify()

FILE: [ROOT]/phpbb/notification/manager.php
LINE: 295
CALL: phpbb\notification\manager->add_notifications_for_users()

FILE: [ROOT]/phpbb/notification/manager.php
LINE: 266
CALL: phpbb\notification\manager->add_notifications()

FILE: [ROOT]/includes/functions_posting.php
LINE: 2400
CALL: phpbb\notification\manager->add_notifications()

FILE: [ROOT]/posting.php
LINE: 1504
CALL: submit_post()
Last edited by Mick on Thu Jan 14, 2021 8:51 am, edited 1 time in total.
Reason: Added code tags for clarity.
Steve Appleton
Registered User
Posts: 13
Joined: Fri Mar 13, 2009 10:31 am
Location: Johannesburg South Africa
Name: Steve Appleton

Re: Duplicate entry '5-43146-17874-5' for key 'PRIMARY' [1062]

Post by Steve Appleton »

Support Request Template
What version of phpBB are you using? phpBB 3.3.2
What is your board's URL? http://friendsoftherail.com/forum
Who do you host your board with? axxess.co.za
How did you install your board? I used the download package from phpBB.com
What is the most recent action performed on your board? Update from a previous version of phpBB3
Is registration required to reproduce this issue? Yes
Do you have any MODs installed? No
Do you have any extensions installed? Yes
What version of phpBB3 did you update from? phpBB 3.1.9
What extensions do you have installed? sortables captcha (derky)
What styles do you currently have installed? prosilver, proflat, prosilver special edition, we_universal
What language(s) is your board currently using? english
Which database type/version are you using? MariaDB
What is your level of experience? New to PHP but not phpBB
What username can be used to view this issue? No answer given
What password can be used to view this issue? No answer given
What actions did you take (updating your board; installing a MOD, style or extension; etc.) prior to this problem becoming noticeable? board was updated from 3.1.9 several weks ago.
Please describe your problem. The Forum intermittently gives the following error when posting a "reply" to a topic. The reply actually does get posted, but the error message makes it seem that it has not.
The BB creates a SQL string to insert the data into the notifications table twice. Because the key is suposedly unique, mysql naturally generates the error message. Question is why is the notification table entry being duplicated? Is there possibly a problem with some entry or other data in the database which was upgraded from an old version (3.1.9).

Code: Select all

  General Error
    SQL ERROR [ mysqli ]

    Duplicate entry '5-43094-17874-3' for key 'PRIMARY' [1062]

    SQL

    INSERT INTO phpbb_notification_emails (item_id, notification_type_id, item_parent_id, user_id) VALUES (43094, 5, 17874, 3), (43094, 5, 17874, 3)

    BACKTRACE

    FILE: (not given by php)
    LINE: (not given by php)
    CALL: msg_handler()

    FILE: [ROOT]/phpbb/db/driver/driver.php
    LINE: 1023
    CALL: trigger_error()

    FILE: [ROOT]/phpbb/db/driver/mysqli.php
    LINE: 195
    CALL: phpbb\db\driver\driver->sql_error()

    FILE: [ROOT]/phpbb/db/driver/driver.php
    LINE: 682
    CALL: phpbb\db\driver\mysqli->sql_query()

    FILE: [ROOT]/phpbb/db/driver/factory.php
    LINE: 393
    CALL: phpbb\db\driver\driver->sql_multi_insert()

    FILE: [ROOT]/phpbb/db/sql_insert_buffer.php
    LINE: 138
    CALL: phpbb\db\driver\factory->sql_multi_insert()

    FILE: [ROOT]/phpbb/notification/method/email.php
    LINE: 118
    CALL: phpbb\db\sql_insert_buffer->flush()

    FILE: [ROOT]/phpbb/notification/manager.php
    LINE: 403
    CALL: phpbb\notification\method\email->notify()

    FILE: [ROOT]/phpbb/notification/manager.php
    LINE: 295
    CALL: phpbb\notification\manager->add_notifications_for_users()

    FILE: [ROOT]/phpbb/notification/manager.php
    LINE: 266
    CALL: phpbb\notification\manager->add_notifications()

    FILE: [ROOT]/includes/functions_posting.php
    LINE: 2400
    CALL: phpbb\notification\manager->add_notifications()

    FILE: [ROOT]/posting.php
    LINE: 1504
    CALL: submit_post()
    
Generated by SRT Generator
rxu
Extensions Development Team
Posts: 3456
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation
Name: Ruslan
Contact:

Re: Duplicate entry '5-43146-17874-5' for key 'PRIMARY' [1062]

Post by rxu »

What way did you use to upgrade (full package / automatic update package)?
If you have direct database access, is there phpbb_notification_emails table in it?
Post Reply

Return to “[3.3.x] Support Forum”