From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#54591: 29.0.50; sqlite-select returns blob result as multibyte string Date: Sat, 02 Apr 2022 16:51:51 +0300 Message-ID: <83h77b4mq0.fsf@gnu.org> References: <83h77jaof6.fsf@gnu.org> <87lewsakng.fsf@gnus.org> <83o81o93ak.fsf@gnu.org> <87a6d672xr.fsf@gnus.org> <878rso7iuu.fsf@flokut.localdomain> <87v8vrljyu.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3177"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 54591@debbugs.gnu.org, fjas@grdm.no To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 02 15:52:18 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1naeAr-0000Vl-CO for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 Apr 2022 15:52:17 +0200 Original-Received: from localhost ([::1]:53192 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1naeAp-0007Iw-T9 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 Apr 2022 09:52:16 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:42154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1naeAe-0007IQ-BP for bug-gnu-emacs@gnu.org; Sat, 02 Apr 2022 09:52:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50994) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1naeAd-0007bU-IL for bug-gnu-emacs@gnu.org; Sat, 02 Apr 2022 09:52:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1naeAc-0007OU-DM for bug-gnu-emacs@gnu.org; Sat, 02 Apr 2022 09:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 02 Apr 2022 13:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54591 X-GNU-PR-Package: emacs Original-Received: via spool by 54591-submit@debbugs.gnu.org id=B54591.164890750328395 (code B ref 54591); Sat, 02 Apr 2022 13:52:02 +0000 Original-Received: (at 54591) by debbugs.gnu.org; 2 Apr 2022 13:51:43 +0000 Original-Received: from localhost ([127.0.0.1]:44891 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1naeAJ-0007Nu-Fj for submit@debbugs.gnu.org; Sat, 02 Apr 2022 09:51:43 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:54404) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1naeAH-0007Ng-OE for 54591@debbugs.gnu.org; Sat, 02 Apr 2022 09:51:42 -0400 Original-Received: from [2001:470:142:3::e] (port=47136 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1naeAB-0007ZC-QO; Sat, 02 Apr 2022 09:51:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=akpDBdCk7DAOgEh2uw9eJKyxuIhlscc6Oe5roBZ/Pyc=; b=qFm81eAWfWYaMwmPGxRO Q5vOl9Fd6UadUF9RnWpfRfPsCquA3F5P9saHVRTkTeil3WUMXWsV0xVrSbpaQ9otgvSdVcsbf2LpS po+DZFFTCNiw9C6JLa28j/9hdWiAecSLb3p64vn+vKptHnpgFGLzRwy2pKUjtgGmBMJEruFiqNWgx C1ZjG1ho6ktwM3q/UDRykQldpsg6vqFTYCb2EUJW3JEYiqUCx7GNdqHHf53UQxfSsc6+pGmncHNTz gGUjxIzvcWqp4S1S0FASN8CaS1Kvz1Q78WTo7qA1QMloFLyVh0ZykvK4ExFNfXKyCMs1+eV/EKrZm YLABXFc7WqdlyA==; Original-Received: from [87.69.77.57] (port=3427 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1naeAB-0003WX-Al; Sat, 02 Apr 2022 09:51:35 -0400 In-Reply-To: <87v8vrljyu.fsf@gnus.org> (message from Lars Ingebrigtsen on Sat, 02 Apr 2022 14:59:21 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:229265 Archived-At: > From: Lars Ingebrigtsen > Date: Sat, 02 Apr 2022 14:59:21 +0200 > Cc: 54591@debbugs.gnu.org > > Let's take a TEXT column first. Currently, if you have the multibyte > string "fóo" and insert with "insert into ... (?)", we encode to utf-8 > and put the bytes #x66#xc3#xb3#x6f into the database. Selecting from > the database, we get the bytes #x66#xc3#xb3#x6f back, decode and return > the string "fóo". > > If you have a unibyte string containing the bytes #x66#xc3#xb3#x6f, we > don't do anything with that, but insert the bytes as is. When > selecting, we decode and return "fóo", which is not what the user > inserted. In this case, it would be nice to signal an error, but we > can't, because we don't know that it's a TEXT column in the first place. We could store unibyte strings as BLOBs, couldn't we? > Conversely, with BLOB columns, we would prefer to signal an error on > multibyte strings, but we can't, because we don't know that it's a BLOB > column. But we do the right thing with unibyte strings -- if you give > it #x66#xc3#xb3#x6f, it'll put those bytes into the BLOB column, and > when selecting, we do know that it's a BLOB column, so we could return > the unibyte string #x66#xc3#xb3#x6f, and everything's fine. However, if > the user wanted to insert the string "fóo", they'll be getting > #x66#xc3#xb3#x6f back and will probably be sad. We could refrain from decoding BLOBs, couldn't we?