Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r7iiR-006Rdu-45 for pgsql-general@arkaria.postgresql.org; Mon, 27 Nov 2023 21:00:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1r7iiP-00GawX-QR for pgsql-general@arkaria.postgresql.org; Mon, 27 Nov 2023 21:00:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r7iiP-00GawJ-FO for pgsql-general@lists.postgresql.org; Mon, 27 Nov 2023 21:00:25 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r7iiM-008qwL-HO for pgsql-general@lists.postgresql.org; Mon, 27 Nov 2023 21:00:24 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 7F8285C01ED; Mon, 27 Nov 2023 16:00:20 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 27 Nov 2023 16:00:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1701118820; x=1701205220; bh=djTxseTo/k7l95Zw4ySwuDf/ibYkadI/kAa bKaFzyqg=; b=Tr9GrlGt3x8RH8eqR/l3ZdDNHtog80AUFoO58AAOEa59ODelO5C OSPasLd9yogMsLEAlCoQm6pcrjpGwbG5osPBw7XSyg0hXMTVyPw13KqxszN6srvZ 6j4XB2Iu8C5lX+/mc+LIfvLescn99MDiEYY4tSf+tEwunBT3VwQNcChV/qGub5NH FqkWFo/c1pkkfyPxFxngDDOCj0HakgE6gF2b7sSJTV2x62qP3JMtQ6Bf27jSiXFO fDUVTVJJq8bF3c8L+1peqCkDBYJj3pqhfpDihS9VlVZME2C0RDx+Jd7iV5n0fxmM ++/AXK5R1LVBtg39nfy7hSSKZF86YpOfQPw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1701118820; x= 1701205220; bh=djTxseTo/k7l95Zw4ySwuDf/ibYkadI/kAabKaFzyqg=; b=s QeJSNA+A3E377AC6XoZHIleTea5+e1RyiHPtoVZKeTKBZoYd8LTE1HfB+tjYmuNc mMi2zvereW9wfc0s8SvhS+R/FTA4mAPLheOx8FmZb2zBlzN/oXchECL80Eh4wI7u 42oU434gjEIzKIcZddbxT4LTunOL5584NSNwjg5EyogTfd1y/t4g6YhISbWr9doI EvZk+L8aHJHUM2HzTIQh8VELwEW48YAZNYLUzz4CQ4qhJFvZxmM5oJRPpoL/xbN3 LNb97PSbV7OzONks0gzpcXrGq20BOSfo9vmRy5q5CPfii22NIMtgUsj/MqOpuX0Q X7MptGqakyTIz2qyfjy3Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudeiuddgudeghecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepkfffgggfuffvfhfhjggtgfesth ekredttddvjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdr khhlrghvvghrsegrkhhlrghvvghrrdgtohhmqeenucggtffrrghtthgvrhhnpeelgeevke ekkeeuiefgtdevieeluefhfedufeetkeejffekjeeujeehgeehgeektdenucffohhmrghi nhepphhoshhtghhrvghsqhhlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdr tghomh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 27 Nov 2023 16:00:19 -0500 (EST) Message-ID: Date: Mon, 27 Nov 2023 13:00:19 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: suppress notices from inside a stored a plpgqsl function Content-Language: en-US To: David Gauthier , pgsql-general@lists.postgresql.org References: From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 11/27/23 12:51, David Gauthier wrote: > Hi: > > I have a plpgsql function that has this... > >     drop table if exists tmp_diff_blkviews; > > Even with the "if exists", I still get... > > NOTICE:  table "tmp_diff_blkviews" does not exist, skipping > CONTEXT:  SQL statement "drop table if exists tmp_diff_blkviews" > PL/pgSQL function dvm.blkview_diffs(character varying,character varying) > line 6 at SQL statement > > I want to suppress that.   Even if the temp table exists, I don't want > to hear about how it had to delete the table.  Just delete it if it > exists and be quiet about it. > > This function is being called through perl/dbi. So client side command > line set options, or anything like that, is no good.  Is there  way to > control messaging from inside the function ? > Per here: https://www.postgresql.org/docs/current/plpgsql-errors-and-messages.html#PLPGSQL-STATEMENTS-RAISE "Whether messages of a particular priority are reported to the client, written to the server log, or both is controlled by the log_min_messages and client_min_messages configuration variables. See Chapter 20 for more information." I have not tried it but maybe SET client_min_messages to something above NOTICE in the function. Or as part of the function creation: https://www.postgresql.org/docs/current/sql-createfunction.html SET configuration_parameter { TO value | = value | FROM CURRENT } -- Adrian Klaver adrian.klaver@aklaver.com