Tarantool development patches archive
 help / color / mirror / Atom feed
From: Mergen Imeev via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: kyukhin@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH v1 1/3] sql: properly set INTEGER type in struct Expr
Date: Thu, 11 Nov 2021 13:53:37 +0300	[thread overview]
Message-ID: <51cd01732d6b5b12644464110b06168ec9db4ace.1636627944.git.imeevma@gmail.com> (raw)
In-Reply-To: <cover.1636627944.git.imeevma@gmail.com>

Prior to this patch, in some cases a struct Expr value with an opcode
TK_INTEGER could have field type ANY. This patch sets such values to the
INTEGER field type.

Part of #3174
---
 src/box/sql/expr.c    | 2 ++
 src/box/sql/resolve.c | 1 +
 src/box/sql/select.c  | 1 +
 3 files changed, 4 insertions(+)

diff --git a/src/box/sql/expr.c b/src/box/sql/expr.c
index 25c390062..2c8021060 100644
--- a/src/box/sql/expr.c
+++ b/src/box/sql/expr.c
@@ -1010,6 +1010,7 @@ sql_expr_new_int(struct sql *db, int value)
 {
 	struct Expr *e = sql_expr_new_empty(db, TK_INTEGER, 0);
 	if (e != NULL) {
+		e->type = FIELD_TYPE_INTEGER;
 		e->flags |= EP_IntValue;
 		e->u.iValue = value;
 	}
@@ -3917,6 +3918,7 @@ sqlExprCodeTarget(Parse * pParse, Expr * pExpr, int target)
 				return target;
 			} else {
 				tempX.op = TK_INTEGER;
+				tempX.type = FIELD_TYPE_INTEGER;
 				tempX.flags = EP_IntValue | EP_TokenOnly;
 				tempX.u.iValue = 0;
 				r1 = sqlExprCodeTemp(pParse, &tempX,
diff --git a/src/box/sql/resolve.c b/src/box/sql/resolve.c
index 21fe124d7..22b4e6799 100644
--- a/src/box/sql/resolve.c
+++ b/src/box/sql/resolve.c
@@ -928,6 +928,7 @@ resolveCompoundOrderBy(Parse * pParse,	/* Parsing context.  Leave error messages
 				}
 				pNew->flags |= EP_IntValue;
 				pNew->u.iValue = iCol;
+				pNew->type = FIELD_TYPE_INTEGER;
 				if (pItem->pExpr == pE) {
 					pItem->pExpr = pNew;
 				} else {
diff --git a/src/box/sql/select.c b/src/box/sql/select.c
index 8ca967108..2f97d121d 100644
--- a/src/box/sql/select.c
+++ b/src/box/sql/select.c
@@ -3566,6 +3566,7 @@ multiSelectOrderBy(Parse * pParse,	/* Parsing context */
 				}
 				pNew->flags |= EP_IntValue;
 				pNew->u.iValue = i;
+				pNew->type = FIELD_TYPE_INTEGER;
 				pOrderBy = sql_expr_list_append(pParse->db,
 								pOrderBy, pNew);
 				if (pOrderBy)
-- 
2.25.1


  reply	other threads:[~2021-11-11 11:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11 10:53 [Tarantool-patches] [PATCH v1 0/3] Introduce field type ANY to SQL Mergen Imeev via Tarantool-patches
2021-11-11 10:53 ` Mergen Imeev via Tarantool-patches [this message]
2021-11-11 10:53 ` [Tarantool-patches] [PATCH v1 2/3] sql: use field_type_MAX instead of FIELD_TYPE_ANY Mergen Imeev via Tarantool-patches
2021-11-11 10:53 ` [Tarantool-patches] [PATCH v1 3/3] sql: introduce field type ANY Mergen Imeev via Tarantool-patches
2021-11-11 11:30 ` [Tarantool-patches] [PATCH v1 0/3] Introduce field type ANY to SQL Kirill Yukhin via Tarantool-patches
  -- strict thread matches above, loose matches on Subject: below --
2021-10-28 10:52 Mergen Imeev via Tarantool-patches
2021-10-28 10:52 ` [Tarantool-patches] [PATCH v1 1/3] sql: properly set INTEGER type in struct Expr Mergen Imeev via Tarantool-patches

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=51cd01732d6b5b12644464110b06168ec9db4ace.1636627944.git.imeevma@gmail.com \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=imeevma@tarantool.org \
    --cc=kyukhin@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v1 1/3] sql: properly set INTEGER type in struct Expr' \
    /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