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 1gTwND-0007LK-2g for pgsql-general@arkaria.postgresql.org; Mon, 03 Dec 2018 22:07:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gTwNB-0006bC-KF for pgsql-general@arkaria.postgresql.org; Mon, 03 Dec 2018 22:07:25 +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 1gTwN9-0006Zh-SM for pgsql-general@lists.postgresql.org; Mon, 03 Dec 2018 22:07:25 +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 1gTwN4-0006iv-U7 for pgsql-general@postgresql.org; Mon, 03 Dec 2018 22:07:23 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 127AF2208A; Mon, 3 Dec 2018 17:07:17 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 03 Dec 2018 17:07:17 -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=C xotlNK5GlRGGU+8CF59CWRD67fEoMwW9wTHmAwYSQg=; b=NnX3QDYUsA2TTc43j 3ymZl2nryf3mc9KAKW+RFhQ0tiO2VzeT7SQHYFrc6O5M5Ro9fIi+zmlzUEY9jUpq rORIJ84kEyZpS/Am5K8MfYF5/SvE1rPAK29AjXVB1Z5kSErAN1KWt71VnO9VU43P oeMyMF1FD8N6ENtBo/3e9XV8RQqG7JRN0ETy4wVKvl3Xpt5PR7c2r2VCWeOzsQ/F 1URDsBjNHcBCKJrLw75o/r7fFvksTKOgSnPv/0jV9WrU+YgJtBAnFHArdWLrQ5jL EqUGlIviors4cGTwDb2M2FoRkEALZh5AQgm9oHK7Kb8MahuvzoWjcJsJi4DEcleV uk9kA== 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=CxotlNK5GlRGGU+8CF59CWRD67fEoMwW9wTHmAwYS Qg=; b=agezFB6J9lF6Bo8u1aIF5BE2gmdGsPeytAbSw2i5pDtt59epTGL8gg3kP 3C9f1s2AuNmUCIVwrC34iZg9W9idVyXB8CSaKV5cgLMq4zl5qGwCyLGvy9UBGgMF cx9utvgI0AFfLZU1xCXTo+71EQrup8GfXVJHmWjaNHerSjtnHHzYH7eiXv1xDGhw W2u4+tRG0fSrPJXGFWj0W/Q/RcPUseFfvl+UxxjEXHkBK2Uw9BdRFAaYEewJEdAA 29nAUFCkIOJ1ASvyolnmdP0xcarorlZylYlZrqNQv9uxsWTmMiN0wdPWvRrmKkyU VyruCUHhXOB5cxghVarW+8vy3JoyQ== 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 11307E455D; Mon, 3 Dec 2018 17:07:15 -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: <98bd69ac-8c42-e41b-d369-263efe377158@aklaver.com> Date: Mon, 3 Dec 2018 14:07:14 -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. Out of curiosity more then anything else: The database schema this is running against never changes? The triggers cannot be included in the initial database setup? > > But I will probably create it on every connection and delete on the > disconnect (see above). > -- Adrian Klaver adrian.klaver@aklaver.com