Re: Making the subquery alias optional in the FROM clause - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: Making the subquery alias optional in the FROM clause
Date
Msg-id CAEZATCV2A=W8-tMSUoHO=69jjzDyaUN7dZ6XTRuhC7r_awBVEg@mail.gmail.com
Whole thread Raw
In response to Re: Making the subquery alias optional in the FROM clause  (Zhihong Yu <zyu@yugabyte.com>)
Responses Re: Making the subquery alias optional in the FROM clause
List pgsql-hackers
On Sat, 9 Jul 2022 at 12:24, Zhihong Yu <zyu@yugabyte.com> wrote:
>
>  It seems the code would be more readable if you keep the assignment in else block below:
>
> +                   else if (rte->rtekind == RTE_SUBQUERY ||
> +                            rte->rtekind == RTE_VALUES)
>                         continue;
> -                   rtename = rte->join_using_alias->aliasname;
>                 }
> -               else
> -                   rtename = rte->eref->aliasname;
>
> because rtename would be assigned in the `rte->rtekind == RTE_JOIN` case.
>

But then it would need 2 else blocks, one inside the rte->alias ==
NULL block, for when rtekind is not RTE_JOIN, RTE_SUBQUERY or
RTE_VALUES, and another after the block, for when rte->alias != NULL.
I find it more readable this way.

Regards,
Dean



pgsql-hackers by date:

Previous
From: Dean Rasheed
Date:
Subject: Re: Use extended statistics to estimate (Var op Var) clauses
Next
From: Graham Leggett
Date:
Subject: Re: [PATCH] Log details for client certificate failures