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 1fVjKH-00029v-Om for pgsql-general@arkaria.postgresql.org; Wed, 20 Jun 2018 20:03:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fVjKF-0007Pk-MW for pgsql-general@arkaria.postgresql.org; Wed, 20 Jun 2018 20:03:31 +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 1fVjJZ-00043q-9z for pgsql-general@lists.postgresql.org; Wed, 20 Jun 2018 20:02:49 +0000 Received: from mail-qt0-x242.google.com ([2607:f8b0:400d:c0d::242]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fVjJV-0000Zv-Bt for pgsql-general@postgresql.org; Wed, 20 Jun 2018 20:02:47 +0000 Received: by mail-qt0-x242.google.com with SMTP id a18-v6so797375qtj.4 for ; Wed, 20 Jun 2018 13:02:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=MdvCX5B96joGrNzW7pF7eRjL4SbB5gzq2M0Cycs3wiE=; b=YQ1xUl4PpWmwNlZ0bAAlZDOvKZmlczkFEv3PN9HuxkR6CWTlasLl/h65gq/vyOzn4C V5uFYGgdIoHlla8ATE0OAkxrr9tFS3lsZ5qiGQKq2qjTMIhqtQAUofXvD86M0QvArNfk AkQBw7KQtGh8EGomQGe5NINhchLvh0+CN0Jb3eqku27itvvwQPUSbrJdtVJI9SYqT5ji iQLFDt2kZ6kBkaTZ2rlEZqS7jN9TtRkyUVR7Ps7FxIwFHnQr38BJdmpy7XrmkpTGWoJA b9elh8ylEmtYs+HbgoOzNA7Ti3tkDr1+2mNF0jC3OMOJxHxuhWB1GENbGybREMDLwqUo 1ThA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=MdvCX5B96joGrNzW7pF7eRjL4SbB5gzq2M0Cycs3wiE=; b=WBJwQurpXzXkAuql3ig6czQfOoUruuF9LsWsbi5WPCUr0LFbasHFZU3twueQzo/WJU PIxl5cNKyIRBp6x7PlKUsEgx4V085YAkffnnZVMk2USgeUAfFnArmgQ4WEFnVdpv5Exh W8M19HWND+xSLdPxEizOnHwV2bbOF9Sw1DoF6NWf34Bzn50CQA8E5VzyAQhYp0V0j113 HGLbTVl1DzGQYIqKTed6pT7poB4PNWSUYaL8oNy8ALD9mFFvS9ca4IgrZUSsFSGsVJkv H4wCnurFPGbcZ5P4/bAzqbGJiCKtQw5Yso2eHHuvY8nlJ16T2aFxl10HbJqBhrvyLxf+ vY4w== X-Gm-Message-State: APt69E09XXVbpavk2+z5Eet9d94RoyMejITdtnqjixCFDVLZRfswpVw9 NiTDXUmzpjgIHqh1DZh7c2rNYg== X-Google-Smtp-Source: ADUXVKKtlc8Z0S7dFlDvXGLCygBsovB1dkQslkRoY9YECVQPdb1HhbFImXNJc95oiMg3cY5eV3IYWQ== X-Received: by 2002:aed:2798:: with SMTP id a24-v6mr21068155qtd.40.1529524964067; Wed, 20 Jun 2018 13:02:44 -0700 (PDT) Received: from alvin.alvh.no-ip.org ([190.121.29.3]) by smtp.gmail.com with ESMTPSA id w92-v6sm391927qte.64.2018.06.20.13.02.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Jun 2018 13:02:43 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 26B3D9F3; Wed, 20 Jun 2018 16:02:42 -0400 (-04) Date: Wed, 20 Jun 2018 16:02:42 -0400 From: Alvaro Herrera To: Igor Korot Cc: Francisco Olarte , "David G. Johnston" , pgsql-general Subject: Re: Is there a way to be notified on the CREATE TABLE execution? Message-ID: <20180620200242.zfiwrulsieuyao25@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170306-137-4415bd-dirty (1.8.0) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2018-Jun-20, Igor Korot wrote: > [quote] > In order to create an event trigger, you must first create a function > with the special return type event_trigger. This function need not > (and may not) return a value; the return type serves merely as a > signal that the function is to be invoked as an event trigger. > [/quote] > > So, the function has to be created and compiled. Event trigger functions can be written in plpgsql. You can use pg_event_trigger_ddl_commands() in the ddl_command_end event to obtain a few tidbits about the DDL that was just executed. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services