Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w4s7r-002dm3-2P for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2026 03:08:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w4s7q-003oKk-0Y for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2026 03:08:14 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w4s7p-003oKb-2t for pgsql-hackers@lists.postgresql.org; Tue, 24 Mar 2026 03:08:14 +0000 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w4s7o-00000000ivq-20PC for pgsql-hackers@lists.postgresql.org; Tue, 24 Mar 2026 03:08:13 +0000 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-66a4c6bb6ecso18965a12.1 for ; Mon, 23 Mar 2026 20:08:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774321691; cv=none; d=google.com; s=arc-20240605; b=DLCdUjeVqb2SsqO8pPVK7jJ73vi1EaCPIQ1hHw2Oybzun33G3BWeohiHMM3QykYIoy ONzc+ZN+eqAV2ICadHuZQq+si1B1raYX2BqOsPUfD6L9cNdub0SkIKyZePYZRzBuYzfK oDMwmOYl2Jl9EWuo1P88EUujJG6ukRv8wubBRAk4DaLkPxQOfXPowOQUITP8xLcQVel0 109tckZz5X9oHxDImxI8uohl6KTzGxvXkiGr+HfyJM05mStz99ftOrXRrvWquHP3rSjY qOKmExE4mxk/RJwxrnUVvB5jtvm7Z7utxJ+nYCOCL8KAR7Aw9z8aUK4GbPh7QphuzCFU 8S6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ONpDs3jSJrMwjmufZAqawEp9UmuvqVJUBoqEyB8eIew=; fh=Wc+q9WCg8mqrwh8v7nNgCdm3A0AmZzC0cAJsPcHjFqc=; b=bhGehGftBqrqRU/bA5IQ/7jO382Rgro+q9sHufzyzFq2JkO7kwtIkM2xdraz2ZKUiL vc5U3w954uMNvhvI+frF8/FDvUDuRnexHUweqEdu9h6yEnyyn4R6+PiCweNZa3NUYsrF nN72iLDUouwGeZ8E5VdiyeZC4i+Ppn36+Fh6d7+SNcAn6yHSvmfk1G2P+QhHrhxS7Nru xapZ3Y78OhhPi0QGnru+CfVttWJwG9SHHdlAjYOz1X0uwW0nDzbygcqC3lRyQlcj60g2 f5LusGFCR/+ww5iy4uIv/NE7O030Uc98LzN7q+0ltybdigcs1iqm2wmv4jd8WZNqfPkj Q7yw==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774321691; x=1774926491; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ONpDs3jSJrMwjmufZAqawEp9UmuvqVJUBoqEyB8eIew=; b=iS8Iw2D2nuT4UCLcQ3gPh/AUS412+wFCXwezTEmwUcmsbxk8zin51UjddnYqOiHrIF Rj/e80jhaJvvEEVGF+YnyrfXOX/uZbV53kL48mYaLlTVzC6pszRng4CBa3BzXgjxd+W1 sSqvhmpqwxOfevUYk+mSf0goYrYU9kDPzJT28ffJ4v3dXCYYw/GL6n8bWBAG5b89EjFv ZQ9fILD41pg8jpy+tVHwttWLbHURT//dl55x8BCBegFBqlc+Q1dERI93dIGEbGbnIfvs +rUrXyeiUpJ71oX05L+q7CMysiOSFbswCSXNFPXVZhEpgYLArorLvUCafZ7j74AoZ6YX a1SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774321691; x=1774926491; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ONpDs3jSJrMwjmufZAqawEp9UmuvqVJUBoqEyB8eIew=; b=iRKGWRfb4tdCRAZYlHi2QgoM2niByS5+x2TkgdI358fglltN874augnlY+yxAnxzd3 11yOnPYhSzSkfZNT8l3hlhdSVgKJOzedJVTpnYW2wLYIerA2h1JtoK2TbVgCrqp8vbhv LoKE5290m/qrnGtyxyBlKE1+AN/N+qaCqgmy/tqqClPDMAvJ6LqQVuadW9ABKhfCWkNt qtc/GHT9ObSxi6x6rpmOF6p74Of2fbPIzdAYmVLc485nLYkHgG+IdMzecOssvvkqbo99 zaoxjie56P/DfWuWfVKfJA1x6n+YbI8ob4513ieFv3UyAP06tRLX1XAt1ciYvx3alGQM BiZQ== X-Gm-Message-State: AOJu0YypDAX3rqkYKPSrDYqcviH2SJSWqs2U2zv9dsqLhzyzF6chbpe5 n6ufGcY4GB8YsqjA0FwuyQCfC6H4ZeZ9tnAgSaDgDEssxmH5gGV8dBJF/XshY6bIBharQaJ6VpT AQzJFdbZKL15y00QdQQSzIe166d+fsxQ= X-Gm-Gg: ATEYQzzQCN9/G1V/i/1XB7oAQQfC3WCxzTddM28danugaXC+x99vTtvQgYWuqTNVMeQ y6UU4NXSC+yF6Szs3YdpZL5Wg8De7d6QSJK+1ZYwQLvUd/V0eh9b1XbZpjjuK46q+lOh8yG9k9I N2dox2ejWHvrT4mn2EqRPAh4DU1O08YTLxgtV/lW0zBHQLDMhdRKhO5BupP9DTAJJr/vI5POZxC X0j/QKdw5UV61MbE3TPF9nQVfwMJuMd2uRp0fbZs/DwDwgmN8kcy9uPBw6BNEb1dqn/liqAqVTq L5jTW8nK X-Received: by 2002:a17:906:c398:b0:b98:2df5:9bf0 with SMTP id a640c23a62f3a-b982f28ac94mr715436566b.22.1774321690621; Mon, 23 Mar 2026 20:08:10 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Tender Wang Date: Tue, 24 Mar 2026 11:07:59 +0800 X-Gm-Features: AQROBzCtEm4wJR29hmgenn_8psvN1nNdSZ1kphw5nBeCoJLQr-vUpzfFYUnBU3A Message-ID: Subject: Re: Fix "could not find memoization table entry" To: David Rowley Cc: PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk David Rowley =E4=BA=8E2026=E5=B9=B43=E6=9C=8824=E6= =97=A5=E5=91=A8=E4=BA=8C 10:39=E5=86=99=E9=81=93=EF=BC=9A > > On Tue, 24 Mar 2026 at 14:10, Tender Wang wrote: > > Actually, I haven't quite figured out why `typLen` cannot be used here. > > This is because we sign-extend rather than zero-extend up to Datum. > Consider this code from master: > > typedef uint64_t Datum; > > static inline Datum > Int32GetDatum(int32 X) > { > return (Datum) X; > } > > So we cast to uint64_t when converting int32 to Datum. > > And consider the output of this C program: > > drowley@amd3990x:~$ cat datum.c > #include > #include > > int main(void) > { > int32_t i32 =3D -1; > uint64_t i64 =3D (uint64_t) i32; > > for (int i =3D 0; i < 64; i++) > { > putchar(i64 & 0x8000000000000000ULL ? '1' : '0'); > i64 <<=3D 1; > } > putchar('\n'); > return 0; > } > > > drowley@amd3990x:~$ gcc datum.c -o datum && ./datum > 1111111111111111111111111111111111111111111111111111111111111111 > > If you only look at the lower 32 bits of that Datum, then you're not > looking at the entire value. Got it. Thanks for your explanation. > I don't have hardware to try it, but I also don't suppose comparing > the first attlen bytes of a Datum does the same thing on big-endian > machines as that would look at the most significant side of the Datum > rather than the least significant side as it would on little-endian. I find comments in datumIsEqual() when typByVal is true: * just compare the two datums. NOTE: just comparing "len" bytes wi= ll * not do the work, because we do not know how these bytes are alig= ned * inside the "Datum". We assume instead that any given datatype i= s * consistent about how it fills extraneous bits in the Datum. Using sizeof(Datum) in datum_image_hash() is totally correct. --=20 Thanks, Tender Wang