Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: "n.pettik" <korablev@tarantool.org>, tarantool-patches@freelists.org
Cc: Roman Khabibov <roman.habibov@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH 0/3 v2] sql: add test for indexed char in sub subquery
Date: Fri, 7 Dec 2018 14:27:46 +0300	[thread overview]
Message-ID: <5b722fb0-7c22-f0d2-55ac-f61cfd0f707d@tarantool.org> (raw)
In-Reply-To: <97B7ED6F-8AD4-47D4-B988-32958A4B1370@tarantool.org>



On 07/12/2018 14:20, n.pettik wrote:
> 
> 
>> On 5 Dec 2018, at 23:35, Vladislav Shpilevoy <v.shpilevoy@tarantool.org> wrote:
>>
>> Vova, please, ignore. It was accidentally sent to you.
>>
>> Nikita, please, review.
> 
> I didn’t receive mail since there were issues with our mailing list,
> so I looked at patch-set on GitHub.
> 
>>
>> On 05/12/2018 02:47, Roman Khabibov wrote:
>>> Branch: https://github.com/tarantool/tarantool/tree/romanhabibov/gh-3580-err-msg-pathjoin
>>> Issue: https://github.com/tarantool/tarantool/issues/3580
>>> Roman Khabibov (2):
>>>    sql: add CHAR description without length
> 
> 
>>      Fix an ability to describe CHAR without specifying the
> 
> Not ‘fix’ but rather ‘add’. Otherwise, it sounds wierd.
> 
>>      length as it is allowed by standard. It was
>>      accidentally broken by this commit:
>>      7752cdfd31f9956a4d6bb0f306c561a0ac73e7ab
>>      
>>      Needed for #3616
> 
> It is not needed for #3616 - this commit and issue are not connected.
> Issue disappeared after static types were introduced. It is ok that
> you added test case on this issue, but these two problems are not related.
> 
> Consider refactoring:
> 
> diff --git a/src/box/sql/parse.y b/src/box/sql/parse.y
> index f5e86fba1..d56fce451 100644
> --- a/src/box/sql/parse.y
> +++ b/src/box/sql/parse.y
> @@ -1485,26 +1485,22 @@ typedef(A) ::= DATE . { A.type = AFFINITY_REAL; }
>   typedef(A) ::= TIME . { A.type = AFFINITY_REAL; }
>   typedef(A) ::= DATETIME . { A.type = AFFINITY_REAL; }
>   
> -%type char_len {int}
> -typedef(A) ::= CHAR char_len(B) . {
> +typedef(A) ::= CHAR . {
>     A.type = AFFINITY_TEXT;
> -  (void) B;
>   }
>   
> -%type vchar_len {int}
> -typedef(A) ::= VARCHAR vchar_len(B) . {
> -  A.type = AFFINITY_TEXT;
> +char_len(A) ::= LP INTEGER(B) RP . {
> +  (void) A;
>     (void) B;
>   }
>   
> -char_len(A) ::=  . {
> -  (void) A;
> +typedef(A) ::= CHAR char_len(B) . {
> +  A.type = AFFINITY_TEXT;
> +  (void) B;
>   }
>   
> -char_len(A) ::=  vchar_len(A) .
> -
> -vchar_len(A) ::= LP INTEGER(B) RP . {
> -  (void) A;
> +typedef(A) ::= VARCHAR char_len(B) . {
> +  A.type = AFFINITY_TEXT;
>     (void) B;
>   }
> 
> In this case code looks a bit more straightforward IMHO.

I've tried this refactoring too but faced with
grammar 'features'. You can not define two rules
starting with the same prefix. Did you test it? Maybe
I was wrong?

> 
>>>    sql: add test for indexed char in sub subquery
> 
> You don’t need to drop and re-create table t2 -
> it doesn’t change in half cases. You should drop it
> only when you change format of table, but in other
> cases it doesn’t affect anything.
> 
>>> Vladislav Shpilevoy (1):
>>>    sql: store CHAR|VARCHAR len as integer, not type_def
> 
> This is OK.
> 

  reply	other threads:[~2018-12-07 11:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-04 23:47 Roman Khabibov
2018-12-04 23:47 ` [PATCH 1/3 v2] sql: store CHAR|VARCHAR len as integer, not type_def Roman Khabibov
2018-12-04 23:47 ` [PATCH 2/3 v2] sql: add CHAR description without length Roman Khabibov
2018-12-04 23:47 ` [PATCH 3/3 v2] sql: add test for indexed char in sub subquery Roman Khabibov
2018-12-05 20:35 ` [tarantool-patches] [PATCH 0/3 " Vladislav Shpilevoy
2018-12-07 11:20   ` [tarantool-patches] " n.pettik
2018-12-07 11:27     ` Vladislav Shpilevoy [this message]
2018-12-07 15:59       ` n.pettik
2018-12-08 16:49     ` roman
2018-12-08 21:21     ` roman
2018-12-08 21:56       ` n.pettik
2018-12-14  5:47 ` [tarantool-patches] " Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5b722fb0-7c22-f0d2-55ac-f61cfd0f707d@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=roman.habibov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH 0/3 v2] sql: add test for indexed char in sub subquery' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox