Re: incorrect results and different plan with 2 very similar queries

Поиск
Список
Период
Сортировка
От Dave Cramer
Тема Re: incorrect results and different plan with 2 very similar queries
Дата
Msg-id CADK3HHLiv-btGRshBhum0sSOM0VaoE9ottzPi-S3sRMNBKKV9A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: incorrect results and different plan with 2 very similar queries  (David Rowley <dgrowleyml@gmail.com>)
Ответы Re: incorrect results and different plan with 2 very similar queries  (Tomas Vondra <tomas.vondra@enterprisedb.com>)
Список pgsql-hackers

Dave Cramer


On Wed, 27 Mar 2024 at 17:57, David Rowley <dgrowleyml@gmail.com> wrote:
On Thu, 28 Mar 2024 at 10:33, Dave Cramer <davecramer@gmail.com> wrote:
> There is a report on the pgjdbc github JDBC Driver shows erratic behavior when filtering on CURRENT_DATE · pgjdbc/pgjdbc · Discussion #3184 (github.com)
>
> Here are the plans.
>
> JDBC - Nested Loop (incorrect result)
>
>                     Index Cond: (mutation >= ((CURRENT_DATE - '1971-12-31'::date) - 28))

> JDBC - Hash Right (correct result)
>
>                     Recheck Cond: (mutation >= ((CURRENT_DATE - '1971-12-31'::date) - 29))

I don't see any version details or queries, but going by the
conditions above, the queries don't appear to be the same, so
different results aren't too surprising and not a demonstration that
there's any sort of bug.

Sorry, you are correct. Version is 12.14. Here is the query

SELECT  p.partseqno_i
, p.partno
, p.partmatch
, pfe.average_price
, pfe.sales_price
, pfe.purch_price
, pfe.average_price_2
, pfe.avg_repair_cost
, pfe.average_price_func
, pfe.fsv
, pfe.fsv_func
, p.status

FROM part p
LEFT JOIN part_fa_entity pfe ON (p.partno = pfe.partno)
WHERE 1=1
AND (p.mutation >= (CURRENT_DATE - '1971-12-31'::date)-27) ORDER BY p.partno 
Dave

David

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Possibility to disable `ALTER SYSTEM`
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: Large block sizes support in Linux