Bug #74912 [Com]: PDO errorInfo 1062 Duplicate entry

From: Date: Thu, 05 Nov 2020 12:18:07 +0000
Subject: Bug #74912 [Com]: PDO errorInfo 1062 Duplicate entry
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-230124@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74912&edit=1

 ID:                 74912
 Comment by:         vlobovikov at gmail dot com
 Reported by:        marc dot w dot hagen at gmail dot com
 Summary:            PDO errorInfo 1062 Duplicate entry
 Status:             Verified
 Type:               Bug
 Package:            PDO related
 Operating System:   Debian 3.2.86-1 x86_64
 PHP Version:        5.6.31
 Block user comment: N
 Private report:     N

 New Comment:

INSERT INTO someTable(...) VALUES(...),(...),..

ON DUPLICATE KEY UPDATE
                    field1 = VALUES(field1),
                    field2 = VALUES(field2)


CREATE TABLE someTable (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  subId VARCHAR(255) NOT NULL,
...
  PRIMARY KEY (id),
  UNIQUE KEY k_transaction(subId),


Previous Comments:
------------------------------------------------------------------------
[2020-11-05 12:14:24] vlobovikov at gmail dot com

$stmt->execute() === false

AND

erroInfo:

Array
(
[0] => 00000
[1] =>
[2] =>
)

------------------------------------------------------------------------
[2020-11-05 12:11:38] vlobovikov at gmail dot com

I have same problem with "INSERT ... ON DUPLICATE KEY UPDATE ...".
My PHP have v7.4.11

------------------------------------------------------------------------
[2020-04-07 12:37:46] marc dot w dot hagen at gmail dot com

Running this code on PHP (7.3.16 / 7.4.2 / 7.4.4) still results in same behaviour. 
I do not know nor test it on sqlite.

------------------------------------------------------------------------
[2020-04-07 12:23:29] cmb@php.net

> Interestingly, pdo_sqlite3 also repeats the driver specific
> error code and message, but has the SQLSTATE error reset to zero.

Oops, this is exactly the same as with pdo_mysql.

------------------------------------------------------------------------
[2020-04-07 12:19:31] cmb@php.net

I can confirm the broken behavior.  Interestingly, pdo_sqlite3
also repeats the driver specific error code and message, but has
the SQLSTATE error reset to zero.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=74912


--
Edit this bug report at https://bugs.php.net/bug.php?id=74912&edit=1


Thread (14 messages)

« previous php.bugs (#230124) next »