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 1hlTUG-00010d-04 for pgsql-general@arkaria.postgresql.org; Thu, 11 Jul 2019 07:27:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hlTUD-0004bG-PH for pgsql-general@arkaria.postgresql.org; Thu, 11 Jul 2019 07:27:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hlTUD-0004b8-Cq for pgsql-general@lists.postgresql.org; Thu, 11 Jul 2019 07:27:25 +0000 Received: from 195-159-176-226.customer.powertech.no ([195.159.176.226] helo=blaine.gmane.org) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hlTUA-0004Wb-5q for pgsql-general@postgresql.org; Thu, 11 Jul 2019 07:27:24 +0000 Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1hlTU6-000598-Ly for pgsql-general@postgresql.org; Thu, 11 Jul 2019 09:27:18 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-general@postgresql.org From: Thomas Kellerer Subject: How to extract information from pg_ddl_command type Date: Thu, 11 Jul 2019 09:27:11 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 X-Mozilla-News-Host: news://news.gmane.org:119 Content-Language: de-DE List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk The function pg_event_trigger_ddl_commands() returns several columns, one of them being "command" that is of the type "pg_ddl_command". The manual[1] describes this column as: > A complete representation of the command, in internal format. > This cannot be output directly, but it can be passed to other > functions to obtain different pieces of information about the > command. However, I can not find any of those "other functions" to extract information from that column. My goal is to get the complete SQL text that fired the event trigger - is that even possible through pg_event_trigger_ddl_commands()? Thanks Thomas [1] https://www.postgresql.org/docs/current/functions-event-triggers.html