Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eImnM-0004UM-R5 for pgsql-hackers@arkaria.postgresql.org; Sun, 26 Nov 2017 02:35:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eImnM-0004UD-0G for pgsql-hackers@arkaria.postgresql.org; Sun, 26 Nov 2017 02:35:48 +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.84_2) (envelope-from ) id 1eImnL-0004U2-Mv for pgsql-hackers@lists.postgresql.org; Sun, 26 Nov 2017 02:35:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eImnE-0005Kx-KV for pgsql-hackers@postgresql.org; Sun, 26 Nov 2017 02:35:46 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id vAQ2ZZwn011943; Sat, 25 Nov 2017 21:35:35 -0500 From: Tom Lane To: Mark Dilger cc: Tomas Vondra , Adrien Nayrat , Pg Hackers Subject: Re: [HACKERS] PATCH: multivariate histograms and MCV lists In-reply-to: <0938F717-F4A0-4568-83B4-80A19887EA25@gmail.com> References: <31ee8686-6d62-7f10-4129-7580ec74a710@dalibo.com> <340ffd44-2d67-d39d-e54f-5a97a842cd3a@2ndquadrant.com> <67EAB5B3-F9FB-4753-8102-4D77DCFFFCD4@gmail.com> <63aa9ad9-cebd-a842-ea50-7f99b94443cd@2ndquadrant.com> <0938F717-F4A0-4568-83B4-80A19887EA25@gmail.com> Comments: In-reply-to Mark Dilger message dated "Sat, 25 Nov 2017 17:17:44 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <11941.1511663735.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 25 Nov 2017 21:35:35 -0500 Message-ID: <11942.1511663735@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Mark Dilger writes: >> On Nov 25, 2017, at 3:33 PM, Tomas Vondra wrote: >> I might be missing something, but why would ereport be more appropriate >> than elog? Ultimately, there's not much difference between elog(ERROR) >> and ereport(ERROR) - both will cause a failure. The core technical differences are (1) an ereport message is exposed for translation, normally, while an elog is not; and (2) with ereport you can set the errcode, whereas with elog it's always going to be XX000 (ERRCODE_INTERNAL_ERROR). > I understand project policy to allow elog for error conditions that will= be reported > in "can't happen" type situations, similar to how an Assert would be use= d. For > conditions that can happen through (mis)use by the user, ereport is appr= opriate. The project policy about this is basically that elog should only be used for things that are legitimately "internal errors", ie not user-facing. If there's a deterministic way for a user to trigger the error, or if it can reasonably be expected to occur during normal operation, it should definitely have an ereport (and a non-default errcode). regards, tom lane