Re: Retire has_multiple_baserels()

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Aleksander Alekseev <aleksander(at)timescale(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Retire has_multiple_baserels()
Date: 2023-10-11 01:59:59
Message-ID: CAMbWs4-Y+ynBA1UjxXZR7=dUGjiQtVxFgWWxnWerHz3N2=a44Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Oct 11, 2023 at 1:13 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> I thought this test wasn't too complete, because has_multiple_baserels
> isn't reached at all in many cases thanks to the way the calling if()
> is coded. I tried testing like this instead:
>
> diff --git a/src/backend/optimizer/path/allpaths.c
> b/src/backend/optimizer/path/allpaths.c
> index eea49cca7b..3f6fc51fb4 100644
> --- a/src/backend/optimizer/path/allpaths.c
> +++ b/src/backend/optimizer/path/allpaths.c
> @@ -2649,6 +2649,8 @@ set_subquery_pathlist(PlannerInfo *root, RelOptInfo
> *rel,
> */
> remove_unused_subquery_outputs(subquery, rel, run_cond_attrs);
>
> + Assert(has_multiple_baserels(root) ==
> (bms_membership(root->all_baserels) == BMS_MULTIPLE));
> +
> /*
> * We can safely pass the outer tuple_fraction down to the subquery
> if the
> * outer level has no joining, aggregation, or sorting to do.
> Otherwise
>
> and came to the same conclusion: check-world finds no cases where
> the assertion fails. So it LGTM too. Pushed.

Thanks for pushing!

Thanks
Richard

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2023-10-11 02:47:44 Re: Lowering the default wal_blocksize to 4K
Previous Message Richard Guo 2023-10-11 01:58:18 Re: Fix typo in psql zh_CN.po