From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 698512831F for ; Fri, 9 Aug 2019 11:15:19 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xGUIImW7iU1g for ; Fri, 9 Aug 2019 11:15:19 -0400 (EDT) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 28E6628315 for ; Fri, 9 Aug 2019 11:15:19 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: [tarantool-patches] Re: [PATCH] sql: add check for absence in From: "n.pettik" In-Reply-To: <20190802125252.54621-1-roman.habibov@tarantool.org> Date: Fri, 9 Aug 2019 18:15:17 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20190802125252.54621-1-roman.habibov@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org Cc: Roman Khabibov > On 2 Aug 2019, at 15:52, Roman Khabibov = wrote: >=20 > Check that hasn't after : "CREATE VIEW v > AS WITH ... SELECT ...". Throw error, if it has. What is the reason for that? I run example from ticket: tarantool> \set language sql tarantool> \set delimiter ; tarantool> CREATE TABLE ts (s1 INT PRIMARY KEY); tarantool> INSERT INTO ts VALUES (1); tarantool> WITH RECURSIVE w AS ( > SELECT s1 FROM ts > UNION ALL > SELECT s1+1 FROM w WHERE s1 < 4) > SELECT * FROM w; tarantool> CREATE VIEW v AS WITH RECURSIVE w AS ( > SELECT s1 FROM ts > UNION ALL > SELECT s1+1 FROM w WHERE s1 < 4) > SELECT * FROM w; - null - Space 'W' does not exist ... So, it fails at the stage of view creation. Please, ask Peter to provide valid example. Otherwise there=E2=80=99s no problem and issue can be closed. >=20 > Closes #4149 > --- > Branch: = https://github.com/tarantool/tarantool/tree/romanhabibov/gh-4149-view > Issue: https://github.com/tarantool/tarantool/issues/4149 >=20 > src/box/sql/build.c | 7 +++++++ > test/sql-tap/view.test.lua | 37 ++++++++++++++++++++++++++++++++++++- > 2 files changed, 43 insertions(+), 1 deletion(-) >=20 > diff --git a/src/box/sql/build.c b/src/box/sql/build.c > index ccec10543..e34202c9a 100644 > --- a/src/box/sql/build.c > +++ b/src/box/sql/build.c > @@ -1320,6 +1320,13 @@ sql_create_view(struct Parse *parse_context) > &create_entity_def->name); > if (space =3D=3D NULL || parse_context->is_aborted) > goto create_view_fail; > + assert(view_def->select !=3D NULL); > + if (view_def->select->pWith !=3D NULL) { > + diag_set(ClientError, ER_CREATE_SPACE, space->def->name, > + "can't create view as "); > + parse_context->is_aborted =3D true; > + goto create_view_fail; > + } This looks like a crutch. Please, either find out if it is possible to fix this at parser level (changing grammar), or simply close issue.