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 1gTpyc-0005Zp-QF for pgsql-general@arkaria.postgresql.org; Mon, 03 Dec 2018 15:17:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gTpyb-0002V4-Dy for pgsql-general@arkaria.postgresql.org; Mon, 03 Dec 2018 15:17:37 +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 1gTpyb-0002Ux-5n for pgsql-general@lists.postgresql.org; Mon, 03 Dec 2018 15:17:37 +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 1gTpyY-0005SD-Lt for pgsql-general@postgresql.org; Mon, 03 Dec 2018 15:17:36 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 7D84322053; Mon, 3 Dec 2018 10:17:33 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 03 Dec 2018 10:17:33 -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=i ZghSScsqhYo5vBwEf/Wd7pSuk3rF+rGcjyya+JMxNg=; b=CjHUpMNBJcUH2cTNQ gViHcVjpoTU2ygqbZDVa0SpB0zLmKX62jWK5tZhTu6nj/Vq2iqKEBpYywp9w2f4r R8547HNahlb+XI5rkqMQygKYLUtgM58DrNeYQ6LBefP8CC+vBA1OtKiUVKMMuHKn c16IZ/QutWjgDoETa8x/Wi6GVFhIBw/5Zy2AWX9u5NFHTan7ogxuMDRiHFEgOuwW pKtxV7PZGMmxi4GJoYfFHR5v/UeyLau1HFZDS6V4pkPmvQ0Nhn9ORbRMP9IASHrc Dr8sL3Z1bU2HK8h0nvTTgjwUwPds3XI59TSHCRYdII3mvwO8b44hM1Ohg3UKCI2H wjiog== 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=iZghSScsqhYo5vBwEf/Wd7pSuk3rF+rGcjyya+JMx Ng=; b=oExt0IKYbLSrDvN2jzE+SVJtP0bkAuSvwCmezshvMochWB3CCAShWGcwu w0HY/UdaohZXjFfNM11qZ6Y51Jwnea1RufdjnXsrYTNhjpS3PMOw7qhoqZYpglcf 5eI82XVdFea3wo64Qw9lTdIZnm4z6JhOLsyk9BM4K9H7GlUqyPwVS3mrf9nUBxlt GNZmmNgUX8AMLPsiK4X0wZhvesl+IpJ1bsBVOR7ueElToMyqekrn+Lw1CUcnWzZC Fnhwz8yLSe6rNRVlVzyVgOuOZxVxTLbBpU/z0p28jFDm+PQFyC0ZxGcoE087+iuS xurXzLBetBRRxRaZ+e5IoeLvp9PuA== 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 925E3103DE; Mon, 3 Dec 2018 10:17:32 -0500 (EST) Subject: Re: How to watch for schema changes To: Igor Korot Cc: pgsql-general References: From: Adrian Klaver Message-ID: <53538bab-5f26-247d-15bf-94785fdfb252@aklaver.com> Date: Mon, 3 Dec 2018 07:17:31 -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/2/18 5:24 AM, Igor Korot wrote: > Hi, Adrian, > Sorry for the delay to come back to this. I was busy doing other things. > > On Tue, Jul 3, 2018 at 12:32 PM Adrian Klaver wrote: >> >> On 07/03/2018 10:21 AM, Igor Korot wrote: >>> Hi, ALL, >>> Is there any trigger or some other means I can do on the server >>> which will watch for CREATE/ALTER/DROP TABLE command and after successful >>> execution of those will issue a NOTIFY statement? >> >> https://www.postgresql.org/docs/10/static/event-triggers.html > > So if I understand correctly, I should write the trigger for the event > I am interested in. > And in this trigger I write a little SQL that will write the DDL > command in some temporary table. > > I'm just looking for a way to execute this trigger and a function from > my C++ code > on the connection (either ODBC or thru the libpq). Event triggers are fired by database events not by external prompting, so you do not need to have your code execute the trigger. You do have the option of disabling/enabling then though: https://www.postgresql.org/docs/10/sql-altereventtrigger.html > > And then in my C++ code I will continuously query this temporary table. Why a temporary table? They are session specific and if the session aborts prematurely you will lose the information. > > Or there is a better alternative on the algorithm? > > Thank you. > >>>> >>> Thank you. >>> >> >> >> -- >> Adrian Klaver >> adrian.klaver@aklaver.com > -- Adrian Klaver adrian.klaver@aklaver.com