Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fC1or-0003YI-Ch for pgsql-general@arkaria.postgresql.org; Fri, 27 Apr 2018 11:45:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fC1oq-0001b1-5n for pgsql-general@arkaria.postgresql.org; Fri, 27 Apr 2018 11:45:40 +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_SHA384:256) (Exim 4.89) (envelope-from ) id 1fC1op-0001ar-Of for pgsql-general@lists.postgresql.org; Fri, 27 Apr 2018 11:45:39 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fC1oJ-0001vP-3b for pgsql-general@postgresql.org; Fri, 27 Apr 2018 11:45:39 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 136AC21C3451; Fri, 27 Apr 2018 14:45:06 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from zakirov.localdomain (gw.postgrespro.ru [93.174.131.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id D9B4421C344E; Fri, 27 Apr 2018 14:45:05 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1524829505; bh=m0/1cJr8eM0wdUgpp4YUtMYpuTdDykf39pRwedcF3JQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=MKQfjx0HNqP5mL/8owGYNZvCaPg9Fi9W9Avm5I0He8uaglmXEULotLoC3OvJ1X+T7 26PFkz8cfxvtQwwNInRKV/22ajv4viW3iic3gyxi1wInfvsaicG5IPS3GR/em/xH2Z FF4JT1qJItLLqH/qNY+BZ3kkiMjNFpzYiKsrz+fY= Date: Fri, 27 Apr 2018 14:45:04 +0300 From: Arthur Zakirov To: legrand legrand Cc: pgsql-general@postgresql.org Subject: Re: pg_stat_statements : how to catch non successfully finished statements ? Message-ID: <20180427114503.GA12829@zakirov.localdomain> References: <1524774265469-0.post@n3.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1524774265469-0.post@n3.nabble.com> User-Agent: Mutt/1.9.5 (2018-04-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello, On Thu, Apr 26, 2018 at 01:24:25PM -0700, legrand legrand wrote: > Hello all, > > I was wondering if there is a hook to collect non successfully finished SQL > statements in pg_stat_statements (timed-out, cancelled, killed, or simply > errored) ? Some time ago I looked for a such hook. My case was to log failed access permissions checks. I didn't find a way to do it, except adding a narrow-focused hook within ExecCheckRTPerms(). There is ErrorContextCallback. Context callbacks are called when an error was raised. But I don't think that it is a good approach for pg_stat_statements cases. -- Arthur Zakirov Postgres Professional: http://www.postgrespro.com Russian Postgres Company