Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p8YGi-0003Mw-DB for psycopg@arkaria.postgresql.org; Fri, 23 Dec 2022 02:58:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p8YGf-0002c9-UF for psycopg@arkaria.postgresql.org; Fri, 23 Dec 2022 02:58:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p8YGf-0002c0-MC for psycopg@lists.postgresql.org; Fri, 23 Dec 2022 02:58:41 +0000 Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1p8YGZ-0003Hy-Eq for psycopg@lists.postgresql.org; Fri, 23 Dec 2022 02:58:41 +0000 Received: by mail-oi1-x234.google.com with SMTP id o66so3590176oia.6 for ; Thu, 22 Dec 2022 18:58:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=fAEU3BvGGPUnCI+VhJt8lB6Q+aCZ8ga4GDhXSKzMrH8=; b=pKFsO7zCnGkbuawBBSunvVeiAXMX0EkG7eXWSm4rH5Ivq9HVHbKm62qrRBcoHmxjmp lTifeqBn9Sxz1/v3acdOa9qwOJyBZcLM8tpld6gKLK7tRXH2T6GnW6IsVElW75rEZloY 2fG6DGtx9wdo1kSDQ80SoaBe1LYEia30YG6LBi2fIX06IC0IzXmP29bS0KFw2H0Roupy D2flf3FokXpnaXgvO408ah3ep45762rPGuCGWCjjxRIeZ8xQhTWv89ySLnygwFUYsx/A 8gMS9gtNOSjdYqiZxRlrxvgJZkkzwpTduAi3resRJb1Y1h756q9hvwqYT46WXNo2iGMU eEaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fAEU3BvGGPUnCI+VhJt8lB6Q+aCZ8ga4GDhXSKzMrH8=; b=FogOP0zFS/XEVlei4HGNd98Yzoum/l1DB+Q6vIpBhetv3zBm5w6SwObzU1njWnZDpa i6sIiAIxRkPyp5N+y3akIpLiKG/Y5HhF4UaexxjoEm6SJyqFD1gFte8Ic5hBJL0IA7+X WtZARaXmV3SvkvvcWF32c/kwREV9+PkBw29F9NsuDRhGvb1W9DjNtBRvcpyrn8tgIKaj bz205McDhuJEZ2IOpItSDiKl+XIjstcOokhbvqAr6rxyFDYh1DpypEkkwPjD+97/68Q2 JzbF2NRX72El9NNBPEQVGKdq2VaiNTqKtQeUNC9QiRVI3hRnwPDUEGHECr2y/tNU0+eY 1a6A== X-Gm-Message-State: AFqh2ko7dQuMoy0oSNK4sn8v5Mbt9nskyucNRkNA1x6emIlvMoN1SrvV IA3/ZdIYtypMLM5vBArOkkVqUybi67uPBdqR2uNaVr7u X-Google-Smtp-Source: AMrXdXubN2vmTXkGeAmxDssaOX2SJqcwChEglsRx217cF2RruUdFf3H4zPRrAM2FO5qPqfY6+srUh+p6u5URdQeFvWk= X-Received: by 2002:a05:6808:3a85:b0:35b:e3c4:afed with SMTP id fb5-20020a0568083a8500b0035be3c4afedmr536770oib.44.1671764313589; Thu, 22 Dec 2022 18:58:33 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Daniele Varrazzo Date: Fri, 23 Dec 2022 02:58:21 +0000 Message-ID: Subject: Re: bug in handling Postgres bytea type? To: Christopher Bader Cc: psycopg@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000000f4c4905f075f6bd" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000000f4c4905f075f6bd Content-Type: text/plain; charset="UTF-8" On Fri, 23 Dec 2022 at 02:54, Christopher Bader wrote: > I'm having problems reading bytea fields with psycopg2. > > Reading a bytea field with cursor.fetchall yields a memoryview object, not > a bytes or bytearray object, and even when the object is explicitly > converted to bytes or bytearray, the result is not correct. > Define not correct. --0000000000000f4c4905f075f6bd Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Fri, 23 Dec 2022 at 02:54, Christopher Bader <cbader@zscaler.com> wrote:
I'm having= problems reading bytea fields with psycopg2.

Reading a = bytea field with cursor.fetchall yields a memoryview object, not a bytes or= bytearray object, and even when the object is explicitly converted to byte= s or bytearray, the result is not correct.
Define not correct.

--0000000000000f4c4905f075f6bd--