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 1g3RNl-0001Tl-Mz for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Sep 2018 19:46:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g3RNi-0008Mk-1q for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Sep 2018 19:46:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g3RNh-0008Md-Lp for pgsql-hackers@lists.postgresql.org; Fri, 21 Sep 2018 19:46:25 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g3RNd-0008GA-P1 for pgsql-hackers@lists.postgresql.org; Fri, 21 Sep 2018 19:46:25 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 0104621C2C3E; Fri, 21 Sep 2018 22:46:19 +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 artur-book.localdomain (unknown [94.29.42.172]) (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 B6CD121C2C3D; Fri, 21 Sep 2018 22:46:19 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1537559179; bh=2kC6oNyopbRfmQmCYTCWy5erRVkS7LUnykTwg7nDK8Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=WH88BnNzg7YZBWgpxY4TmkPGbGJ5+sbgW+IsxAgO73gd9O2EpChj/fOPocPedtynM K3xMOgInt+es1/CkqJ/YlLOZECTg0nGXJG8e8XwSC6cVhFzIvkZfJ/2z72ztahPowD moVv1q3SgNZbi3ZofpbjwgLkUT4/huTPXtS/AUN4= Date: Fri, 21 Sep 2018 22:46:18 +0300 From: Arthur Zakirov To: Pavel Stehule Cc: Dean Rasheed , Fabien COELHO , Gilles Darold , PostgreSQL Hackers Subject: Re: [HACKERS] proposal: schema variables Message-ID: <20180921194617.GA8051@artur-book.localdomain> References: <20180919112305.GA18604@zakirov.localdomain> <20180919125324.GA31127@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 04:36:40PM +0200, Pavel Stehule wrote: > ON COMMIT DROP is used only for temp variables (transaction or not > transaction). The purpose is same like for tables. Sometimes you can to > have object with shorter life than is session. > > ON TRANSACTION END RESET has sense mainly for not transaction variables. I > see two use cases. > > 1. protect some sensitive data - on transaction end guaranteed reset and > cleaning on end transaction. So you can be sure, so variable is not > initialized (has default value), or you are inside transaction. > > 2. automatic initialization - ON TRANSACTION END RESET ensure so variable > is in init state for any transaction. > > Both cases has sense for transaction or not transaction variables. > > I am thinking so transaction life time for content has sense. Is cheaper to > reset variable than drop it (what ON COMMIT DROP does) > > What do you think? Thanks, I understood the cases. But I think there is more sense to use these options only with transactional variables. It is more consistent and simple for me. As a summary, it is 1 voice vs 1 voice :) So it is better to leave the syntax as is without changes for now. -- Arthur Zakirov Postgres Professional: http://www.postgrespro.com Russian Postgres Company