From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 4691B4696C3 for ; Tue, 24 Dec 2019 03:27:34 +0300 (MSK) Date: Tue, 24 Dec 2019 03:27:33 +0300 From: Nikita Pettik Message-ID: <20191224002733.GA41539@tarantool.org> References: <20191219151758.GD28206@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20191219151758.GD28206@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH 6/6] sql: extend result set with alias List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergey Ostanevich Cc: tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org 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 >