Tarantool development patches archive
 help / color / mirror / Atom feed
From: Roman Khabibov <roman.habibov@tarantool.org>
To: tarantool-patches@freelists.org
Cc: v.shpilevoy@tarantool.org
Subject: [tarantool-patches] [PATCH 1/2] sql: fix collation node duplication in AST
Date: Wed,  8 May 2019 14:29:15 +0300	[thread overview]
Message-ID: <c87fe7d113b4c3710c3eca299824caea5346ec5b.1557312975.git.roman.habibov@tarantool.org> (raw)
In-Reply-To: <cover.1557312975.git.roman.habibov@tarantool.org>

Before this patch, if SELECT was used with compound query, COLLATION
clauses and ORDER BY clause, C function resolveAlias built extra node
with collation name into OrderBy's AST.
E.g., for query:

SELECT a COLLATE "unicode_ci" FROM t2 EXCEPT SELECT a FROM t3 ORDER BY 1

was appeared something like: "unicode_ci"
			     /	       \
       extra node -> "unicode_ci"     NULL
		     /	        \
		   "A"		NULL
		   / \
		NULL NULL

Needed for #3804
---
 src/box/sql/resolve.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/box/sql/resolve.c b/src/box/sql/resolve.c
index 504096e6d..c2c597dc0 100644
--- a/src/box/sql/resolve.c
+++ b/src/box/sql/resolve.c
@@ -109,7 +109,7 @@ resolveAlias(Parse * pParse,	/* Parsing context */
 		return;
 	if (zType[0] != 'G')
 		incrAggFunctionDepth(pDup, nSubquery);
-	if (pExpr->op == TK_COLLATE) {
+	if (pExpr->op == TK_COLLATE && pDup->op != TK_COLLATE) {
 		pDup =
 		    sqlExprAddCollateString(pParse, pDup, pExpr->u.zToken);
 	}
-- 
2.20.1 (Apple Git-117)

  reply	other threads:[~2019-05-08 11:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-08 11:29 [tarantool-patches] [PATCH 0/2] sql: allow <COLLATE> only for string-like args Roman Khabibov
2019-05-08 11:29 ` Roman Khabibov [this message]
2019-05-12 16:32   ` [tarantool-patches] Re: [PATCH 1/2] sql: fix collation node duplication in AST Vladislav Shpilevoy
2019-05-28 14:10     ` Roman Khabibov
2019-06-02 17:09       ` Vladislav Shpilevoy
2019-06-04 14:00         ` Roman Khabibov
2019-05-08 11:29 ` [tarantool-patches] [PATCH 2/2] sql: allow <COLLATE> only for string-like args Roman Khabibov
2019-05-12 16:32   ` [tarantool-patches] " Vladislav Shpilevoy
2019-05-28 14:08     ` Roman Khabibov
2019-06-02 17:09       ` Vladislav Shpilevoy
2019-06-04 14:27         ` Roman Khabibov
2019-06-04 19:49           ` Vladislav Shpilevoy
2019-06-07 15:01             ` Roman Khabibov
2019-06-09 16:55               ` Vladislav Shpilevoy

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=c87fe7d113b4c3710c3eca299824caea5346ec5b.1557312975.git.roman.habibov@tarantool.org \
    --to=roman.habibov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [tarantool-patches] [PATCH 1/2] sql: fix collation node duplication in AST' \
    /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