[Tarantool-patches] [PATCH 6/6] sql: extend result set with alias

Nikita Pettik korablev at tarantool.org
Tue Dec 24 03:27:33 MSK 2019


On 19 Dec 18:17, Sergey Ostanevich wrote:
> Hi!
> 
> In the current branch I see the following opportunity:

Thanks, Vlad suggested the same refactoring, I've applied it.
 
> diff --git a/src/box/sql/select.c b/src/box/sql/select.c
> index c1770e7b4..3fc8b2f96 100644
> --- a/src/box/sql/select.c
> +++ b/src/box/sql/select.c
> @@ -1828,12 +1828,10 @@ generate_column_metadata(struct Parse *pParse, struct SrcList *pTabList,
>                         const char *name = NULL;
>                         if (pEList->a[i].zName != NULL) {
>                                 if (is_full_meta) {
> -                                       const char *alias = NULL;
> +                                       const char *alias = pEList->a[i].zName;
>                                         if (pEList->a[i].zSpan != NULL) {
> -                                               alias = pEList->a[i].zName;
>                                                 name = pEList->a[i].zSpan;
>                                         } else {
> -                                               alias = pEList->a[i].zName;
>                                                 name = pEList->a[i].zName;
>                                         }
>                                         vdbe_metadata_set_col_alias(v, i, alias);
> @@ -1868,12 +1866,10 @@ generate_column_metadata(struct Parse *pParse, struct SrcList *pTabList,
>                         const char *z = NULL;
>                         if (pEList->a[i].zName != NULL) {
>                                 if (is_full_meta ) {
> -                                       const char *alias = NULL;
> +                                       const char *alias = pEList->a[i].zName;
>                                         if (pEList->a[i].zSpan != NULL) {
> -                                               alias = pEList->a[i].zName;
>                                                 z = pEList->a[i].zSpan;
>                                         } else {
> -                                               alias = pEList->a[i].zName;
>                                                 z = pEList->a[i].zName;
>                                         }
>                                         vdbe_metadata_set_col_alias(v, i, alias);
> 
> 
> 
> Although, I see you have unfinished discussion on whether name should be alias 
> or vice versa - I won't interrupt you.
> 
> Regards,
> Sergos
> 


More information about the Tarantool-patches mailing list