Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kpwOw-0001iL-3A for pgsql-general@arkaria.postgresql.org; Thu, 17 Dec 2020 16:45:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kpwOv-0002rV-1y for pgsql-general@arkaria.postgresql.org; Thu, 17 Dec 2020 16:45:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kpwOu-0002rM-NS for pgsql-general@lists.postgresql.org; Thu, 17 Dec 2020 16:45:12 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kpwOn-0008TD-Ln for pgsql-general@postgresql.org; Thu, 17 Dec 2020 16:45:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Type:MIME-Version:References:Reply-To: Message-ID:Subject:Cc:To:Sender:From:Date:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=GXIyhLFMZOTbhqG+w7D+2BM5tCU/xMk//8gqv5nQjzc=; b=Hn3fPjlg8enF93lYMmN0/F3yRh 92TnelkRf5jcQ4B63IUwFviucIAfxr66WYhjV8bmc+mQ9g6YyDCe6RY1mFLcUiqjCiMoJejFDA9XK GWQeOuDjraW1yqAGZ37zE8trInD/sGg8z5mlwCetWnzmo1blngWlI8GzjHYUYF4K4syE=; Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by depesz.com with esmtpa (Exim 4.92) (envelope-from ) id 1kpwOm-0005XX-2C; Thu, 17 Dec 2020 17:45:04 +0100 Date: Thu, 17 Dec 2020 17:45:03 +0100 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: Joel Jacobson Cc: pgsql-general@postgresql.org Subject: Re: Raise exception without using plpgsql? Message-ID: <20201217164503.GA18792@depesz.com> Reply-To: depesz@depesz.com References: <7479ca12-af3c-44c3-9ddd-a2074eb82a12@www.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <7479ca12-af3c-44c3-9ddd-a2074eb82a12@www.fastmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Dec 17, 2020 at 03:32:09PM +0100, Joel Jacobson wrote: > Hi, > Is there a way to raise an exception with a message, > without having to add your own plpgsql helper-function? > Currently this is what I have: Well, you can: DO $$ begin raise notice 'zz'; END; $$; It's cheating though, as it still needs plpgsql. Best regards, depesz