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.94.2) (envelope-from ) id 1rzHaZ-002u7u-6t for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Apr 2024 14:57:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rzHaX-008zAh-FV for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Apr 2024 14:57:41 +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.94.2) (envelope-from ) id 1rzHaX-008zAW-64 for pgsql-hackers@lists.postgresql.org; Tue, 23 Apr 2024 14:57:41 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rzHaU-004GTw-K2 for pgsql-hackers@lists.postgresql.org; Tue, 23 Apr 2024 14:57:39 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 43NEvamc3335676; Tue, 23 Apr 2024 10:57:36 -0400 From: Tom Lane To: "Guo, Adam" cc: "pgsql-hackers@lists.postgresql.org" Subject: Re: pg_trgm comparison bug on cross-architecture replication due to different char implementation In-reply-to: References: Comments: In-reply-to "Guo, Adam" message dated "Tue, 23 Apr 2024 14:45:20 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3335674.1713884256.1@sss.pgh.pa.us> Date: Tue, 23 Apr 2024 10:57:36 -0400 Message-ID: <3335675.1713884256@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "Guo, Adam" writes: > I would like to report an issue with the pg_trgm extension on > cross-architecture replication scenarios. When an x86_64 standby > server is replicating from an aarch64 primary server or vice versa, > the gist_trgm_ops opclass returns different results on the primary > and standby. I do not think that is a supported scenario. Hash functions and suchlike are not guaranteed to produce the same results on different CPU architectures. As a quick example, I get regression=# select hashfloat8(34); hashfloat8 ------------ 21570837 (1 row) on x86_64 but postgres=# select hashfloat8(34); hashfloat8 ------------ -602898821 (1 row) on ppc32 thanks to the endianness difference. > Given that this has problem has come up before and seems likely to > come up again, I'm curious what other broad solutions there might be > to resolve it? Reject as not a bug. Discourage people from thinking that physical replication will work across architectures. regards, tom lane