Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH 1/1] sql: trust column duplicate check to box
@ 2020-03-15 17:41 Vladislav Shpilevoy
  2020-03-16 13:02 ` Nikita Pettik
  0 siblings, 1 reply; 2+ messages in thread
From: Vladislav Shpilevoy @ 2020-03-15 17:41 UTC (permalink / raw)
  To: tarantool-patches, korablev

CREATE TABLE used to check column name duplicates before going to
box. But it is not necessary, because the same check is done by
box.
---
Branch: http://github.com/tarantool/tarantool/tree/gerold103/drop-column-duplicate-check-from-sql

 src/box/sql/build.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/src/box/sql/build.c b/src/box/sql/build.c
index fbfd05cbf..7511fad37 100644
--- a/src/box/sql/build.c
+++ b/src/box/sql/build.c
@@ -324,13 +324,6 @@ sqlAddColumn(Parse * pParse, Token * pName, struct type_def *type_def)
 		pParse->is_aborted = true;
 		return;
 	}
-	for (uint32_t i = 0; i < def->field_count; i++) {
-		if (strcmp(z, def->fields[i].name) == 0) {
-			diag_set(ClientError, ER_SPACE_FIELD_IS_DUPLICATE, z);
-			pParse->is_aborted = true;
-			return;
-		}
-	}
 	struct field_def *column_def = &def->fields[def->field_count];
 	memcpy(column_def, &field_def_default, sizeof(field_def_default));
 	column_def->name = z;
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Tarantool-patches] [PATCH 1/1] sql: trust column duplicate check to box
  2020-03-15 17:41 [Tarantool-patches] [PATCH 1/1] sql: trust column duplicate check to box Vladislav Shpilevoy
@ 2020-03-16 13:02 ` Nikita Pettik
  0 siblings, 0 replies; 2+ messages in thread
From: Nikita Pettik @ 2020-03-16 13:02 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches

On 15 Mar 18:41, Vladislav Shpilevoy wrote:
> CREATE TABLE used to check column name duplicates before going to
> box. But it is not necessary, because the same check is done by
> box.

LGTM. Pushed to master as obvious.

> ---
> Branch: http://github.com/tarantool/tarantool/tree/gerold103/drop-column-duplicate-check-from-sql
> 
>  src/box/sql/build.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/src/box/sql/build.c b/src/box/sql/build.c
> index fbfd05cbf..7511fad37 100644
> --- a/src/box/sql/build.c
> +++ b/src/box/sql/build.c
> @@ -324,13 +324,6 @@ sqlAddColumn(Parse * pParse, Token * pName, struct type_def *type_def)
>  		pParse->is_aborted = true;
>  		return;
>  	}
> -	for (uint32_t i = 0; i < def->field_count; i++) {
> -		if (strcmp(z, def->fields[i].name) == 0) {
> -			diag_set(ClientError, ER_SPACE_FIELD_IS_DUPLICATE, z);
> -			pParse->is_aborted = true;
> -			return;
> -		}
> -	}
>  	struct field_def *column_def = &def->fields[def->field_count];
>  	memcpy(column_def, &field_def_default, sizeof(field_def_default));
>  	column_def->name = z;
> -- 
> 2.21.1 (Apple Git-122.3)
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-16 13:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-15 17:41 [Tarantool-patches] [PATCH 1/1] sql: trust column duplicate check to box Vladislav Shpilevoy
2020-03-16 13:02 ` Nikita Pettik

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