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 1t8hyV-005YvN-GY for pgsql-bugs@arkaria.postgresql.org; Wed, 06 Nov 2024 15:29:38 +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 1t8hyS-00741V-RB for pgsql-bugs@arkaria.postgresql.org; Wed, 06 Nov 2024 15:29:37 +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 1t8hyS-00741N-6F for pgsql-bugs@lists.postgresql.org; Wed, 06 Nov 2024 15:29:36 +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 1t8hyP-000US9-T5 for pgsql-bugs@lists.postgresql.org; Wed, 06 Nov 2024 15:29:35 +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 4A6FTVYV3243408; Wed, 6 Nov 2024 10:29:31 -0500 From: Tom Lane To: Aidar Uldanov cc: David Rowley , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18690: A count function returns wrong value when using FDW In-reply-to: References: <18690-cbb98b56ecb0b130@postgresql.org> Comments: In-reply-to Aidar Uldanov message dated "Wed, 06 Nov 2024 16:10:57 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3243406.1730906971.1@sss.pgh.pa.us> Date: Wed, 06 Nov 2024 10:29:31 -0500 Message-ID: <3243407.1730906971@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Aidar Uldanov writes: > David, after some troubleshooting I found out that the issue with FWD and > bigint values, so when column type int then it works well but after > changing to a bigint type a count() function returns the wrong value. > create table transactions( > id serial primary key, > amount int, > org_id int, > recurring_payment_id int REFERENCES recurring_payments(id) > ); > ... > CREATE FOREIGN TABLE transactions_f ( > id serial, > amount bigint, > org_id int, > recurring_payment_id int > ) > SERVER foreign_server > OPTIONS (schema_name 'public', table_name 'transactions'); While it's sort of interesting that that misbehaves, I do not believe that postgres_fdw promises to work correctly with foreign-table definitions that don't match the remote table's actual column datatypes. regards, tom lane