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 948FF24059 for ; Thu, 12 Sep 2019 07:54:10 -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 ymVhArnoMax2 for ; Thu, 12 Sep 2019 07:54:10 -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 5A3092376F for ; Thu, 12 Sep 2019 07:54:09 -0400 (EDT) Date: Thu, 12 Sep 2019 14:54:05 +0300 From: Nikita Pettik Subject: [tarantool-patches] Re: [PATCH v2 2/3] sql: disallow ck using non-persistent function Message-ID: <20190912115405.GA92833@tarantool.org> References: <2c39792c46f84fc38b0a3e2b50fb27fc1d229142.1568275504.git.kshcherbatov@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <2c39792c46f84fc38b0a3e2b50fb27fc1d229142.1568275504.git.kshcherbatov@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: Kirill Shcherbatov On 12 Sep 11:06, Kirill Shcherbatov wrote: > Each CK constraint object is a part of the database schema and > is restored during recovery. It is not possible if a CK > constraint uses some user-defined function inside. Thus we should > disallow non-persistent functions participate in ck constraints. This patch should be dropped taking into consideration last patch in series: it implements fix for special case of the problem solved in the next patch. > diff --git a/test/sql/checks.test.lua b/test/sql/checks.test.lua > index 9716647d0..051c9ae38 100644 > --- a/test/sql/checks.test.lua > +++ b/test/sql/checks.test.lua > @@ -273,6 +273,25 @@ box.execute("DROP TABLE test;") > > test_run = require('test_run').new() > test_run:cmd('switch default') > -test_run:cmd('stop server test') > + > +-- > +-- gh-4176: Can't recover if check constraint involves function. > +-- Make sure that non-persistent functions can't participate in > +-- check constraints, since after instance reboot they disappear > +-- and check constraint can't be created. > +-- > +function myfunc(x) return x < 10 end > +box.schema.func.create("MYFUNC", {exports = {'LUA', 'SQL'}, param_list = {'integer'}}) Nit: name shoul be lowercased I guess.