Bug #81134 [Opn->Dup]: SQLite3 ext INSERT with RETURNING causes duplicate rows

From: Date: Mon, 14 Jun 2021 08:33:25 +0000
Subject: Bug #81134 [Opn->Dup]: SQLite3 ext INSERT with RETURNING causes duplicate rows
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234401@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81134&edit=1 ID: 81134 Updated by: cmb@php.net Reported by: achernow at gmail dot com Summary: SQLite3 ext INSERT with RETURNING causes duplicate rows -Status: Open +Status: Duplicate Type: Bug Package: SQLite related Operating System: MacOS Catalina 10.15.7 PHP Version: 7.4.20 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Duplicate of bug #64531. Previous Comments: ------------------------------------------------------------------------ [2021-06-13 15:26:48] achernow at gmail dot com Description: ------------ SQLite Shell - 3.35.5 2021-04-19 18:32:05 sqlite> CREATE TABLE profile ( profile_id INTEGER PRIMARY KEY autoincrement, name VARCHAR(64), email VARCHAR(255), age INT NOT NULL DEFAULT 0, created VARCHAR(20) NOT NULL DEFAULT CURRENT_TIMESTAMP ); sqlite> -- run php example sqlite> select * from profile; profile_id name email age created ---------- -------- ----------- --- ------------------- 1 Adam Fry a@gmail.com 47 2021-06-13 14:54:08 2 Adam Fry a@gmail.com 47 2021-06-13 14:54:08 Notice it creates two identical rows. This is the issue. If I remove the returning clause, it only creates one row. Test script: --------------- // SQLite3 extension version 3.35.5 $db = new SQLite3('tests/file.db'); $result = $db->query("INSERT INTO profile (age, email, name) VALUES (47, 'a@gmail.com', 'Adam Fry') RETURNING profile_id, email"); print_r($result->fetchArray(SQLITE3_ASSOC)); $db->close(); Expected result: ---------------- When I do an insert of a single record, I would expect it to store a single row. I would expect to see this: sqlite> -- run php example sqlite> select * from profile; profile_id name email age created ---------- -------- ----------- --- ------------------- 1 Adam Fry a@gmail.com 47 2021-06-13 14:54:08 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81134&edit=1

« previous php.bugs (#234401) next »