From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 598366ECC0; Tue, 14 Dec 2021 00:47:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 598366ECC0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1639432068; bh=R1Ht4y9v63EmBNIwtUGvApnYiQkgmiXogoogYh09QO8=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=SkB4eVtfjmwsd8foKZuOC1N53YzBywJNKyAbBssmolhcUeR5tc3szV6Ur819AySCd ynleiQNAqfyD/PumaMdMLPfYhCXa7Qv2V4kMfeBahQGAg7WmtIPKb4udcsJIDz3IDq 0iKjpt27RFZSYAZ1tuD0xg8/At57tFQh95EM+3bg= Received: from smtpng3.i.mail.ru (smtpng3.i.mail.ru [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 451FE6ECC0 for ; Tue, 14 Dec 2021 00:47:46 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 451FE6ECC0 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1mwtAf-0001Is-Fi; Tue, 14 Dec 2021 00:47:45 +0300 Message-ID: <6d11ad7b-89d6-551c-2a14-2a53b8b0be3c@tarantool.org> Date: Mon, 13 Dec 2021 22:47:44 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Content-Language: en-US To: Mergen Imeev Cc: tarantool-patches@dev.tarantool.org References: <20211125083336.GA56448@tarantool.org> <819eff36-2d59-3328-e442-10703dbbda99@tarantool.org> <20211202083253.GA8207@tarantool.org> <20211213073440.GA41198@tarantool.org> In-Reply-To: <20211213073440.GA41198@tarantool.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9FFF274446F725B747018D585DA6107D8FF4BDEEAD395806E182A05F538085040F0EAB9AA828DC2F13D78EFA6512FDCF09C775EF7BF866C1D584D93939F68E3A5 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7586684DD3F99AA20EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637129C704593A46970EA1F7E6F0F101C6723150C8DA25C47586E58E00D9D99D84E1BDDB23E98D2D38BBCA57AF85F7723F200BCC2459DDE8DF8FB5BB28C0034131FCC7F00164DA146DAFE8445B8C89999728AA50765F79006370277CA7F994D7EF5389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC8EDCF5861DED71B2F389733CBF5DBD5E9B5C8C57E37DE458B9E9CE733340B9D5F3BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B093A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E7354E672349037D5FA5C4224003CC83647689D4C264860C145E X-C1DE0DAB: 0D63561A33F958A5EC4CE176E2E868C0D987A9AD5B82898FF11E29658AF01084D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA759D2A03B9C34326B3410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D349EC559D073CA5B683C88442F5991274D933CFB418CF28AF1D5DDDBC98D3428A3194FC35324A662E41D7E09C32AA3244CB252FFEFD7A824DEA6929519551927B039C99C45E8D137E9729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojonEvmBC42e95IDOR2YGU/w== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D9C8E25549E36C9A093E340EC197F7C943841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E25FEEDEB644C299C0ED14614B50AE0675 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v1 1/2] sql: properly check bind variable names X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi! Thanks for the fixes! >>>>>>> diff --git a/src/box/sql/expr.c b/src/box/sql/expr.c >>>>>>> index eb169aeb8..74a98c550 100644 >>>>>>> --- a/src/box/sql/expr.c >>>>>>> +++ b/src/box/sql/expr.c >>>>>>> @@ -1314,6 +1314,52 @@ sqlExprAssignVarNumber(Parse * pParse, Expr * pExpr, u32 n) >>>>>>> } >>>>>>> } >>>>>>> >>>>>>> +struct Expr * >>>>>>> +expr_variable(struct Parse *parse, struct Token *spec, struct Token *id) >>>>>> >>>>>> 1. You might want to call it expr_new_variable(). Or sql_expr_new_variable(). >>>>>> To be consistent with our naming policy for constructors allocating memory >>>>>> and for consistency with with sql_expr_new_column(), sql_expr_new(), >>>>>> sql_expr_new_dequoted(), sql_expr_new_named(), sql_expr_new_anon(). >>>>>> >>>>> Thank you! I renamed it to expr_new_variable(). I believe we should drop 'sql_' >>>>> prefix for functions that only accessible in SQL. >>>> >>>> It would work for static functions. But if a function is visible in other >>>> modules as a symbol, then you would get a conflict during linking if we >>>> ever introduce another 'struct expr' somewhere. Even if they do not interest >>>> anywhere in the code. However I don't mind leaving it as is. It can be fixed >>>> later if ever needed. >>>> >>> I agree. However, I think we need to rework all the places where BOX uses >>> internal SQL functions and structures. In this case, the struct expr should >>> never be available in the BOX, so there should be no conflicts. >> >> It is a misunderstanding. It does not matter if you use a function in box or >> not. If it is not static and is defined in 2 places - you will get a conflict >> during link stage. Try to add a function with the same name to any file in >> sql and to any file in box. Something like >> >> void >> link_test123(void) >> { >> printf("in link test\n"); >> } >> >> (in a .cc file you would need to add 'extern "C"' for it). It will raise an >> error during build. I added it to expr.c and to box.cc (with 'extern "C"'): >> >> duplicate symbol '_link_test123' in: >> ../../src/box/libbox.a(box.cc.o) >> ../../src/box/libbox.a(expr.c.o) >> ld: 1 duplicate symbol for architecture x86_64 >> > Got it, thanks for the explanation. It might be better to rename "struct Expr" > to "struct sql_expr", in which case we will naturally use the sql_expr_ * prefix > for such functions. How do you think? Sounds good to me.