Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gTwQR-0007Uf-WD for pgsql-general@arkaria.postgresql.org; Mon, 03 Dec 2018 22:10:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gTwQQ-0002re-Kf for pgsql-general@arkaria.postgresql.org; Mon, 03 Dec 2018 22:10:46 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1gTwQQ-0002rU-Cc for pgsql-general@lists.postgresql.org; Mon, 03 Dec 2018 22:10:46 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gTwQN-0006pO-Sq for pgsql-general@postgresql.org; Mon, 03 Dec 2018 22:10:45 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 7ACB822240; Mon, 3 Dec 2018 17:10:42 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 03 Dec 2018 17:10:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=K vodkCHV8Yb14tMkVz9gWn9VGghqw02Yo5UZcG5ELfg=; b=I3oV3bAxFnHdSQyBh tVarHd8nLdOUY2w9ke27YwSxlao4twhHqBaLj8mmz6CZT463eD+6r18mywBUdSZI Yjn2AOeauPTdOLTi63qjy+OpkTLDv+0N6/eF4pGTSpDiKvovaMzM0O6+wgFLEoH6 2tLryeV/iw8oyN8ymLE+QPYeKFTnl+DqAMzYyV3DH1P3cNnU7Ml+xYrmcCVN/qr1 2+4GjhX6YOap+eK4xX80B2ssJyBylBJwzBu/fG/cOxYwxxclcjVeSep+lkYNW8Qz hMPSsySeTNuWfZYABsX9EACrJUGaubsC9qlgUeOpYMlpPMDK+qZ6T6Y2zBpAkmpJ XUb7g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=KvodkCHV8Yb14tMkVz9gWn9VGghqw02Yo5UZcG5EL fg=; b=Cr20a8750AfFgLSd+cSZocWpfTglQe1zrFcD2p9f+FBaUXamGcl4Eguw5 G1lsnLsnShRaPe/hddnVWKCqQiv5OtYZ1TwFq1p5bzm1cJVzj2wL4Yx1YFwhCtW8 ShRBVFGM04no4suUvsH3MzcGPom6xptb+RZswRd+RViu1Z8uTrKunFET48HwoKbq Zsku4cAmPDHgGBPgq0e/SaJWcqaK4RAxNEvjJS6DZkpv8nL40Odb8jijDAttyDvy vLKBEmsAMMg3orek6sJxJJsFz2Ez6xyNofkOmPSMuyCOjuxshAqa9sJxfBJeZ+eD m4PRxxzR/7kTv/Xy2laVVQhaR3QmA== X-ME-Sender: X-ME-Proxy: Received: from [192.168.1.3] (unknown [71.212.134.3]) by mail.messagingengine.com (Postfix) with ESMTPA id 3C332E4750; Mon, 3 Dec 2018 17:10:41 -0500 (EST) Subject: Re: How to watch for schema changes To: Igor Korot Cc: pgsql-general References: <53538bab-5f26-247d-15bf-94785fdfb252@aklaver.com> <761d4f03-08f4-e354-9cc0-d3cc5d0319c4@aklaver.com> <4316b506-95d0-59b2-7857-5ae896e07e60@aklaver.com> From: Adrian Klaver Message-ID: <0790286e-e1f9-b8cc-7eb5-2fddfa208737@aklaver.com> Date: Mon, 3 Dec 2018 14:10:40 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 12/3/18 1:53 PM, Igor Korot wrote: > Hi, Adrian, >> Why? Just create the trigger once in a script. Event triggers are an >> attribute of the database and stay with it until they are dropped. If >> you want to turn then on and off use the ALTER EVENT TRIGGER >> ENABLE/DISABLE. If you insist on recreating them on each connection then: >> >> https://www.postgresql.org/docs/10/sql-dropeventtrigger.html >> DROP EVENT TRIGGER [ IF EXISTS ] name [ CASCADE | RESTRICT ] >> CREATE EVENT TRIGGER ... > > I was hoping to create a software which will be just "install-and-use". > No additional script running or database changes is required. After I hit reply my subconscious kicked in and pointed out something:) If there are no database changes why do you need to track schema changes? > > But I will probably create it on every connection and delete on the > disconnect (see above). > -- Adrian Klaver adrian.klaver@aklaver.com