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 1faQLA-0005R5-25 for pgsql-general@arkaria.postgresql.org; Tue, 03 Jul 2018 18:47:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1faQL8-0006MV-H0 for pgsql-general@arkaria.postgresql.org; Tue, 03 Jul 2018 18:47:50 +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 1faQL6-0006MO-Lj for pgsql-general@lists.postgresql.org; Tue, 03 Jul 2018 18:47:50 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1faQL3-00083w-Ab for pgsql-general@postgresql.org; Tue, 03 Jul 2018 18:47:47 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 6781D211E5; Tue, 3 Jul 2018 14:47:44 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 03 Jul 2018 14:47:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=B5svQlRB4QlkbMv8ZR3w5cgTTmUL3 t5XEDpbrZuHoq4=; b=WRZKA05XUfopq5SlLuiPBLFfZbgLzlgvmDgQ0zAzw3qqM Aaw9enwQ7mh8H9LCnTjIKCUMiJMdfZh/1Z/ofa3tgeqkJFmXEa9xNy+bwFcjzxVA xp8EtWRGPdYSbGC3DVW0eudTnpKqpxMHGK+p61IYdMxGVzxk/+zCrpWYAfo1+fJd IYZMHKaGhT5jyKjNjhSge8sA9rw8PNzqT2I/aeTvf7O//i6Ga+IdJaD4ZJ2TgrA2 UjIsWy1KKda5WvVbPNhi9B1poBNEc6drgQxSaddcS0Awq2P1AFgqMxH03sE7p0n+ 67lQaD7qxn21pzRTfzn6jqZrRUYDhnnL5xIFbph8A== 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-sender:x-me-sender:x-sasl-enc; s=fm3; bh=B5svQl RB4QlkbMv8ZR3w5cgTTmUL3t5XEDpbrZuHoq4=; b=vNoa5751towxxKdS6WG6xI R/hXY9wo4HdCTu40bvBcW672aipIuHnA5CtP4ZsR6WEaOykjOx1vBwpoXqEEAJF1 QKNoUe2/MVVvqPbMh+7YsjFNXeS5ng4QkRXwqPL7XY79ICCDcBW19E+GDJn2cj9b /iPLrcM7JDdmdrYxp8gGOFBt4GnL27u4mKo1eQNVqDifUYmEBDTW/xBg9URXU8DG tkTqsN5KvCFwZlGA8U3pdDBQvEOSk6CnuI046c6/n5UXSDgYPu2nWAIHBriSXLHA LregfH+OPv1XbOEi8syg/5vyn64+Uc9bvFDSKMzffB3PxTh0h766Hyy+kt6alANQ == X-ME-Proxy: X-ME-Sender: Received: from ranger.suse (c-73-239-117-238.hsd1.wa.comcast.net [73.239.117.238]) by mail.messagingengine.com (Postfix) with ESMTPA id 8BA2D10262; Tue, 3 Jul 2018 14:47:43 -0400 (EDT) Subject: Re: How to watch for schema changes To: Igor Korot Cc: pgsql-general References: <7fc929ec-8e34-5824-6511-d1dd1188434f@aklaver.com> From: Adrian Klaver Message-ID: Date: Tue, 3 Jul 2018 11:47:42 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.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 07/03/2018 11:41 AM, Igor Korot wrote: > Adrian, > > On Tue, Jul 3, 2018 at 1:24 PM, Adrian Klaver wrote: >> On 07/03/2018 11:15 AM, Igor Korot wrote: >> >> Are you forced to work with 9.1 or can you use something from here: >> >> https://www.postgresql.org/download/macosx/ >> >> to get a newer version? FYI that will be a major upgrade so will require a >> dump/restore or use of pg_upgrade. > > Unfortunately I'm stuck with 9.1. > But I have a Linux machine which have a newer version so I can test > this solution. > And it would be nice to have both machine/versions working. > Well it won't be back ported so I am not seeing that working in 9.1 and I don't know of any other solution. >> It can use functions written in PL languages. See below: >> >> https://www.postgresql.org/docs/10/static/sql-createeventtrigger.html >> >> for an example written in plpgsql. > > OK. > I presume threre is a query which check for the function/trigger > existence? Something like: > > IF NOT EXIST(SELECT * FROM ) CREATE OR REPLACE FUNCTION....; https://www.postgresql.org/docs/10/static/catalog-pg-event-trigger.html > > Thank you. -- Adrian Klaver adrian.klaver@aklaver.com