Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g2bz6-0005m6-2C for pgsql-hackers@arkaria.postgresql.org; Wed, 19 Sep 2018 12:53:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g2bz4-0003sU-5u for pgsql-hackers@arkaria.postgresql.org; Wed, 19 Sep 2018 12:53:34 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g2bz3-0003sK-Oy for pgsql-hackers@lists.postgresql.org; Wed, 19 Sep 2018 12:53:33 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g2bz0-0000Pm-05 for pgsql-hackers@lists.postgresql.org; Wed, 19 Sep 2018 12:53:32 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 6FD4221C27E1; Wed, 19 Sep 2018 15:53:27 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from zakirov.localdomain (gw.postgrespro.ru [93.174.131.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id EACEA21C27C7; Wed, 19 Sep 2018 15:53:26 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1537361607; bh=fE/bMnYay4Jh79iwpCQzXtuJn52DYZBxukH3eKlC8II=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=pLpTwp6pfzzPfymLOaauxRfIrHkwhToZmk3stFBLneTArWtpZTEyyBe+ZDQfVXbIZ /TMxhP7KiacYP1rqgih8jxF65CMMp5j21EEGV8g86QJLq+7HZfy6dzWlfDwdl1f9ku h1rXuAXXD/3MMRBYi5osPiK5+UMAFma8Er6Netps= Date: Wed, 19 Sep 2018 15:53:25 +0300 From: Arthur Zakirov To: Pavel Stehule Cc: Dean Rasheed , Fabien COELHO , Gilles Darold , PostgreSQL Hackers Subject: Re: [HACKERS] proposal: schema variables Message-ID: <20180919125324.GA31127@zakirov.localdomain> References: <20180919112305.GA18604@zakirov.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Sep 19, 2018 at 02:08:04PM +0200, Pavel Stehule wrote: > Unfortunately we cannot to use standard > "SET" command, because it is used in Postgres for different purpose. > READ|WRITE are totally clear, and for user it is another signal so > variables are different than tables (so it is not one row table). > > I prefer current state, but if common opinion will be different, I have not > problem to change it. I see. I grepped the thread before writhing this but somehow missed the discussion. > The content of variables is not transactional (by default). It is not > destroyed by rollback. So I have to calculate with rollback too. So the > most correct syntax should be "ON COMMIT ON ROLLBACK RESET" what is little > bit messy and I used "ON TRANSACTION END". It should be signal, so this > event is effective on rollback event and it is valid for not transaction > variable. This logic is not valid to transactional variables, where ON > COMMIT RESET has sense. But this behave is not default and then I prefer > more generic syntax. > ... > So I see two different cases - work with catalog (what is transactional) > and work with variable value, what is (like other variables in programming > languages) not transactional. "ON TRANSACTION END RESET" means - does reset > on any transaction end. > > I hope so I explained it cleanly - if not, please, ask. I understood what you mean, thank you. I thought that { ON COMMIT DROP | ON TRANSACTION END RESET } parameters are used only for transactional variables in the first place. But is there any sense in using this parameters with non-transactional variables? That is when we create non-transactional variable we don't want that the variable will rollback or reset its value after the end of a transaction. -- Arthur Zakirov Postgres Professional: http://www.postgrespro.com Russian Postgres Company