From nobody Sat Jul 06 17:56:12 2024 X-Original-To: freebsd-questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WGdNb5MlGz5PHWy for ; Sat, 06 Jul 2024 17:56:15 +0000 (UTC) (envelope-from r.m@rmswch.plus.com) Received: from avasout-ptp-001.plus.net (avasout-ptp-001.plus.net [84.93.230.227]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "avasout.plus.net", Issuer "GeoTrust TLS RSA CA G1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WGdNZ6278z50L6 for ; Sat, 6 Jul 2024 17:56:14 +0000 (UTC) (envelope-from r.m@rmswch.plus.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=plus.com header.s=042019 header.b=pofbIiLD; dmarc=none; spf=none (mx1.freebsd.org: domain of r.m@rmswch.plus.com has no SPF policy when checking 84.93.230.227) smtp.mailfrom=r.m@rmswch.plus.com Received: from opendev.home ([80.229.151.92]) by smtp with SMTP id Q9dss3kOg4PsgQ9dtsiJkO; Sat, 06 Jul 2024 18:56:13 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1720288573; bh=OxMXxiNx6T/UI10MpPwT3tFaglDa+ykqFrugiw9687I=; h=Date:From:To:Subject; b=pofbIiLDBnBHwJXxiXIxIXLEfdvS8DasuYgXjdS7CIeu/fJel4OQXQHMeOH6YLq4X 9MGzmpJVUQ7TknEZJXOk2P2nB2bIAkxmCxZO0PWEe10KRudgq8gkmnVabS92heclYP 1ofS7vUpsuJztT6UzADjbGBDZ/WR/cW+PBqAcG6otei8YfsOHKShrwLya2ZbcG7Ig2 ghWdQyiruqZcPDAybjwD+7nAtPSpsCvVK98O2JwVVhaXHMbuSNMMh+QN/z9Z2MtKp1 bjYW8X20Ti2QWlzFQw2Hl3ugIR1iyrDAFxqVwG/8ED6MOyBE3wEklIclwwUkkONCoB YlrCdc+azPNUw== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=eeSefKEH c=1 sm=1 tr=0 ts=6689853d a=6xlXYeu7y0jVCiZ/8t1ozg==:117 a=6xlXYeu7y0jVCiZ/8t1ozg==:17 a=l5a0Lw2Lsyz7zFqPH5cA:9 a=CjuIK1q_8ugA:10 a=pX8CbCtnQw11f6GLFNAA:9 Date: Sat, 6 Jul 2024 17:56:12 +0000 From: Roger Marsh To: freebsd-questions@freebsd.org Subject: sqlite3.OperationalError seen after freebsd-update from 14.0 to 14.1 and ports upgrade Message-ID: <20240706175612.0dd7ad18@opendev.home> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-unknown-openbsd7.5) List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-questions@freebsd.org Sender: owner-freebsd-questions@FreeBSD.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/_K4Ve8z/W.S1rTnI07hgcX+" X-CMAE-Envelope: MS4xfPWddGE98VKrFyl/UsUJ0A3nw6xhyH8xboM9hRZXZulEvfsKZwLwbB/Dviwia7gTNpqHlQQIeEDMGqt2dztkDTV36ElpJcYjsLa+CNM7c9lq6xa4jOd7 6d4TxRnrltFYyc7EEnFvDYoZ66XY8sEVNkI0+ehsMYoJeHhiNyBxb2LmLvtvqdwDccJsXKqNAneNJnkkPXeGrtk9dOMC1VeYeOk= X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.40 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.998]; R_DKIM_ALLOW(-0.20)[plus.com:s=042019]; ONCE_RECEIVED(0.10)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain,text/x-python]; RWL_MAILSPIKE_GOOD(-0.10)[84.93.230.227:from]; RCVD_IN_DNSWL_LOW(-0.10)[84.93.230.227:from]; ARC_NA(0.00)[]; RCVD_COUNT_ONE(0.00)[1]; RCPT_COUNT_ONE(0.00)[1]; MIME_TRACE(0.00)[0:+,1:+,2:+]; ASN(0.00)[asn:6871, ipnet:84.92.0.0/15, country:GB]; DKIM_TRACE(0.00)[plus.com:+]; MLMMJ_DEST(0.00)[freebsd-questions@freebsd.org]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; DMARC_NA(0.00)[plus.com]; R_SPF_NA(0.00)[no SPF record]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_LAST(0.00)[]; HAS_ATTACHMENT(0.00)[] X-Rspamd-Queue-Id: 4WGdNZ6278z50L6 --MP_/_K4Ve8z/W.S1rTnI07hgcX+ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, The SQL statement: select field1 , Segment , RecordCount , file1 from file1_field1 where field1 == "one" and Segment == 0 gets exception: sqlite3.OperationalError: no such column: one when executed via the sqlite3 or apsw modules in Python3.9 on FreeBSD 14.1. The exception is not seen on various Python versions on OpenBSD or Microsoft Windows 10, and was not seen on FreeBSD before the upgrade to 14.1. The attachment has the following code to cause the exception. import sqlite3 as engine FIELD1 = " ".join( ( "create table if not exists file1_field1", "( field1 , Segment , RecordCount, file1 )", ) ) if __name__ == "__main__": dbenv = engine.Connection(":memory:") cursor = dbenv.cursor() cursor.execute("begin") cursor.execute(FIELD1) cursor.execute("commit") ss = " ".join( ( "select field1 , Segment , RecordCount , file1 from", 'file1_field1 where field1 == "one" and Segment == 0', ) ) dbenv.cursor().execute(ss) Bug? Roger --MP_/_K4Ve8z/W.S1rTnI07hgcX+ Content-Type: text/x-python Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=test__sqlite_essential.py # test__sqlite_essential.py # Trimmed down version of unit test which has this error. # No exceptions seen on OpenBSD: # Python 3.10.14 sqlite_version 3.44.2. # No exceptions seen on Microsoft Windows 10: # Python 3.12.0 sqlite_version 3.42.0. # No exceptions seen on MSys2 (Microsoft Windows 10): # Python 3.11.8 sqlite_version 3.45.1. # No exceptions seen on FreeBSD before ports upgrade after freebsd-update # from 14.0 to 14.1. # But on FreeBSD 14.1: # Python 3.9.18 sqlite_version 3.45.1. # 'sqlite3.OperationalError: no such column: one' with sqlite3. # 'apsw.SQLError: SQLError: no such column: one" with apsw. import sqlite3 as engine # Same outcome with apsw instead of sqlite3. # Real code does these operations on nested dict of file and field names. FIELD1 = " ".join( ( "create table if not exists file1_field1", "( field1 , Segment , RecordCount, file1 )", ) ) if __name__ == "__main__": # Essential statements for problem extracted from methods in real code. dbenv = engine.Connection(":memory:") # "memory:" accepted by sqlite3. cursor = dbenv.cursor() cursor.execute("begin") cursor.execute(FIELD1) cursor.execute("commit") ss = " ".join( ( "select field1 , Segment , RecordCount , file1 from", 'file1_field1 where field1 == "one" and Segment == 0', ) ) dbenv.cursor().execute(ss) # Real code has this in a method. #cursor.execute(ss) # This line has the exception too. --MP_/_K4Ve8z/W.S1rTnI07hgcX+--