Explain with limit diff.sql

application/octet-stream

Filename: Explain with limit diff.sql
Type: application/octet-stream
Part: 2
Message: Re: BUG #18950: pgsql function that worked in Postgresql 16 does not return in Postgresql 17
 diff 'Explain with limit.sql' 'Explain without limit.sql'
1c1,4
<  Limit  (cost=10248.11..10248.81 rows=1 width=99)
---
>  Hash Right Join  (cost=10248.23..10248.68 rows=1 width=99)
>    Hash Cond: (pef.facility_key = t_1.facility_key)
>    Filter: (t.devstatus_date >= CASE WHEN (((max(pef.facility_type_start_date)) IS NOT NULL) AND ((max(pef.facility_type_start_date)) > ((max(t_1.devstatus_date)) - '1 mon'::interval))) T
HE
> N ((max(pef.facility_type_start_date)))::timestamp without time zone ELSE ((max(t_1.devstatus_date)) - '1 mon'::interval) END)
71,75c74,82
<    ->  Nested Loop  (cost=45.71..46.41 rows=1 width=99)
<          Join Filter: ((t.facility_key = t_1.facility_key) AND (t.devstatus_date >= CASE WHEN (((max(pef.facility_type_start_date)) IS NOT NULL) AND ((max(pef.facility_type_start_date)) >
 (
< (max(t_1.devstatus_date)) - '1 mon'::interval))) THEN ((max(pef.facility_type_start_date)))::timestamp without time zone ELSE ((max(t_1.devstatus_date)) - '1 mon'::interval) END))
<          ->  Nested Loop Left Join  (cost=45.71..46.36 rows=1 width=19)
<                Join Filter: (pef.facility_key = t_1.facility_key)
---
>    ->  HashAggregate  (cost=1.36..1.54 rows=18 width=8)
>          Group Key: pef.facility_key
>          ->  Seq Scan on ppt_exception_facilities pef  (cost=0.00..1.27 rows=18 width=8)
>                Filter: (facility_type_start_date < CURRENT_DATE)
>    ->  Hash  (cost=44.45..44.45 rows=1 width=103)
>          ->  Nested Loop  (cost=44.35..44.45 rows=1 width=103)
>                Join Filter: (t.facility_key = t_1.facility_key)
>                ->  CTE Scan on t  (cost=0.00..0.03 rows=1 width=92)
>                      Filter: (devstatus_date <= CURRENT_DATE)
92,98c99
<                ->  HashAggregate  (cost=1.36..1.54 rows=18 width=8)
<                      Group Key: pef.facility_key
<                      ->  Seq Scan on ppt_exception_facilities pef  (cost=0.00..1.27 rows=18 width=8)
<                            Filter: (facility_type_start_date < CURRENT_DATE)
<          ->  CTE Scan on t  (cost=0.00..0.03 rows=1 width=92)
<                Filter: (devstatus_date <= CURRENT_DATE)
< (93 rows)
---
> (94 rows)