Re: psql12.3 + jdbc_fdw - return wrong query results by using OR

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: emi(dot)lu(at)concordia(dot)ca, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: psql12.3 + jdbc_fdw - return wrong query results by using OR
Date: 2020-05-28 16:40:04
Message-ID: 625d4581-6b92-6368-f1a2-eedf4f6c890a@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 5/28/20 8:39 AM, emilu(at)encs(dot)concordia(dot)ca wrote:
> Hello,
>
> psql12.3 + jdbc_fdw(oracle18.x), tried:
>
> [1]
> select count(*)
> from oracle_t1 as a
> inner join local_t1 as b
> on (a.c1 = b.c1);
>
> return 100 records
>
> [2]
> select count(*)
> from oracle_t1 as a
> inner join local_t1 as b
> on (a.c1 = b.c1
>     OR
>     a.c2 = b.c1
>    );
>
> return only 2 records
>
> (no null values in both tables.)
>
> May I know what may cause the error please?

I'm guessing you are seeing this:

https://www.postgresql.org/docs/12/sql-expressions.html

4.2.14. Expression Evaluation Rules

". Boolean expressions (AND/OR/NOT combinations) in those clauses can be
reorganized in any manner allowed by the laws of Boolean algebra."

It would help to see the EXPLAIN ANALYZE for the queries above.

>
> Thanks a lot.
>
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2020-05-28 17:05:25 Re: psql12.3 + jdbc_fdw - return wrong query results by using OR
Previous Message emilu 2020-05-28 15:39:56 psql12.3 + jdbc_fdw - return wrong query results by using OR