Re: BUG #18690: A count function returns wrong value when using FDW

From: Aidar Uldanov <aidar(at)donorbox(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18690: A count function returns wrong value when using FDW
Date: 2024-11-06 15:46:26
Message-ID: CAOCMfzmfhO0wMqBDRPjzAtTsgR_8bFSdQDedgDqGEEjRD5JgiA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

oh sorry, I might forget to update int to bigint there. Actually both
should be bigint.
First I tried with int type and it works well and after changing to bigint
I got the wrong count value.

Thanks and regards
Aidar

On Wed, Nov 6, 2024 at 4:29 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Aidar Uldanov <aidar(at)donorbox(dot)org> 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
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-11-06 17:08:53 Re: BUG #18692: Segmentation fault when extending a varchar column with a gist index with custom signal length
Previous Message Tom Lane 2024-11-06 15:29:31 Re: BUG #18690: A count function returns wrong value when using FDW