From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS63949 45.79.64.0/19 X-Spam-Status: No, score=-3.0 required=3.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_PASS,T_RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from ms.lwn.net (ms.lwn.net [45.79.88.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 1FB7D1F404 for ; Thu, 22 Feb 2018 23:14:16 +0000 (UTC) Received: from lwn.net (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ms.lwn.net (Postfix) with ESMTPSA id 251A92C6 for ; Thu, 22 Feb 2018 23:14:15 +0000 (UTC) Date: Thu, 22 Feb 2018 16:14:14 -0700 From: Jonathan Corbet To: meta@public-inbox.org Subject: SQLite, UPDATE, and LIMIT Message-ID: <20180222161414.24d305f1@lwn.net> Organization: LWN.net MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable List-Id: So I'm messing with public-inbox a bit. I had to make the following change before things would work on my Fedora system. (This is with v1.0.0). The symptom was errors out of SQLite; it wouldn't pass "make test" much less work properly. Some digging turns up this: If SQLite is built with the SQLITE_ENABLE_UPDATE_DELETE_LIMIT compile-time option then the syntax of the UPDATE statement is extended with optional ORDER BY and LIMIT clauses as follows Evidently, Fedora does not enable that option. Now, I assume that LIMIT is there for a reason; I've not even tried to look at the schema that public-inbox uses yet. But I thought I would toss this out there to see you thought. Perhaps what I really need to do is to ask Fedora to turn that option on? Thanks, jon =46rom f0d6f3771013fadbeb8432533d51545696309ffb Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Thu, 22 Feb 2018 23:05:46 +0000 Subject: [PATCH] Don't use LIMIT in UPDATE statements ...not all distributions build SQLite with that enabled. --- lib/PublicInbox/Msgmap.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PublicInbox/Msgmap.pm b/lib/PublicInbox/Msgmap.pm index a147b9f..6b6d1c6 100644 --- a/lib/PublicInbox/Msgmap.pm +++ b/lib/PublicInbox/Msgmap.pm @@ -57,7 +57,7 @@ sub meta_accessor { $prev =3D $dbh->selectrow_array($sql, undef, $key); =20 if (defined $prev) { - $sql =3D 'UPDATE meta SET val =3D ? WHERE key =3D ? LIMIT 1'; + $sql =3D 'UPDATE meta SET val =3D ? WHERE key =3D ?'; $dbh->do($sql, undef, $value, $key); } else { $sql =3D 'INSERT INTO meta (key,val) VALUES (?,?)'; --=20 2.14.3