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 1gTzeK-0007Be-9E for pgsql-general@arkaria.postgresql.org; Tue, 04 Dec 2018 01:37:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gTzeJ-0005tp-09 for pgsql-general@arkaria.postgresql.org; Tue, 04 Dec 2018 01:37:19 +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 1gTzeH-0005ti-Bi for pgsql-general@lists.postgresql.org; Tue, 04 Dec 2018 01:37:18 +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 1gTzeC-0002yx-GV for pgsql-general@postgresql.org; Tue, 04 Dec 2018 01:37:16 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id D0B7121DC1; Mon, 3 Dec 2018 20:37:10 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 03 Dec 2018 20:37:10 -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=r eAZs8IW6ozQCkYyBGB/ZmHyddOVr2gZcQU5pPTL7i8=; b=sJsu3ejOmAE+iJwYc HSnPJQBARQ/LVqF7luvjJrEYiq3wA0BZjL9RD0Bu9GfVZdRGdXbUvxc+l+e5FqFT CnHH1ExrtpZtEbbIBdBxENJ5G0PtaLNO3jPigWJkpQ2rqetL4wu8K18f1hp+a8Ez UF4Trbo8gEbzcnM+hNXi9ZlIqbKLqs9UaUGaE+sQBJ/7ksmhvrAFdbitnDbr/OhC mdjCIHAbkhWgoE5EdVpjfkuctnXyWoSngo4nGlLNwaHLuZXeq7hal6Vy+nPNb9aR kypXCWNrWvNeNP/E1BXUAXhkutan3fOuRiGiFoGSxBcbbNxi8Q6yjbtEV7ubCiRU t7qxQ== 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=reAZs8IW6ozQCkYyBGB/ZmHyddOVr2gZcQU5pPTL7 i8=; b=fPRbbaS3cVG0kdPbqb8kudqPYplLwv32KLQr7l+ivAAO7z171BD47UH7s 3VSlZ0E4uKFbZP4CYp+PXlkYgUKDMS5kEzHq06JZ9gE7sxxwQI7VM8h4n9U215K5 L+SvrryN9Xvu1rFMD5aWeq9RRdCk6t+JelODW+Dtli3kf0Oeg1iL/xTb7R+ZYbIF U3xlhbRmXhD3b/lLHNvo8qK2nbOky58F+Q807cb7pfv8lNoPt/wmKB3oa3hUEQX8 2F/vY5+gPS40Qb29BHDE18l6mIT2ZVOgsxQ91HMnExnGIvLuZj/g1t6Gi09ofkEt DDkcIVGAvfHfXm2l5I0LQNtZlM3cg== 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 09FA3E4043; Mon, 3 Dec 2018 20:37:09 -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> <0790286e-e1f9-b8cc-7eb5-2fddfa208737@aklaver.com> <46a41f36-2799-a3ac-867b-d0f6195fd6bd@aklaver.com> From: Adrian Klaver Message-ID: Date: Mon, 3 Dec 2018 17:37:08 -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 5:29 AM, Igor Korot wrote: > Hi, Adrian, > > On Mon, Dec 3, 2018 at 5:15 PM Adrian Klaver wrote: >> >> On 12/3/18 3:00 PM, Igor Korot wrote: >>> Hi, Adrian, >>> >>> >>> What I mean to say was "no schema changes/server changes that comes >>> independently >>> of the program install". Or something to that extent. >> >> Which circles back around to the same question: >> >> If there are to be no schema changes after the install why track them on >> subsequent connections? >> >> Or maybe an explanation of what you are trying to achieve would make >> things clearer? > > Ok, it probably will make things clearer. > So I install my program perform some queries and exit. > At the same time if the user will create or delete a table the program should > pick up those changes and act accordingly. So do you want the user to change the schema? Or could you use permissions to stop that? I am just seeing a difficult problem trying to divine user intent from schema changes. > > I was hoping to do the watching initialization dynamically, but it looks as it > is more pain and I can probably try to execute the script during the > installation. > > So basically I will create the function in C, compile it and then > during the program installation > create a trigger with that function. > Then in my program I will execute "LISTEN" command and act accordingly. > > Am I right? Not sure I have never tried LISTEN on event trigger output. > > And executing LISTEN will also work for ODBC connection, right? Again not something I am familiar with. Someone else on this list may be able to answer that. Or there is: https://www.postgresql.org/list/pgsql-odbc/ > > Thank you. > >> >> >> >>> >>> Sorry, ESL person here. >>> >>> Thank you. >>> >>>> >>>>> >>>>> But I will probably create it on every connection and delete on the >>>>> disconnect (see above). >>>>> >>>> >>>> -- >>>> Adrian Klaver >>>> adrian.klaver@aklaver.com >>> >> >> >> -- >> Adrian Klaver >> adrian.klaver@aklaver.com > -- Adrian Klaver adrian.klaver@aklaver.com