pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mark Dilger <hornschnorter@gmail.com>
Cc: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: Adrien Nayrat <adrien.nayrat@dalibo.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] PATCH: multivariate histograms and MCV lists
Date: Sat, 25 Nov 2017 21:35:35 -0500
Message-ID: <11942.1511663735@sss.pgh.pa.us> (raw)
In-Reply-To: <0938F717-F4A0-4568-83B4-80A19887EA25@gmail.com>
References: <dfdac334-9cf2-2597-fb27-f0fb3753f435@2ndquadrant.com>
	<31ee8686-6d62-7f10-4129-7580ec74a710@dalibo.com>
	<b3688203-7c5d-2d7e-58b6-a6bb04f29b5c@2ndquadrant.com>
	<340ffd44-2d67-d39d-e54f-5a97a842cd3a@2ndquadrant.com>
	<b3e23e18-afbb-2a39-8e15-fe0a6c39a128@2ndquadrant.com>
	<67EAB5B3-F9FB-4753-8102-4D77DCFFFCD4@gmail.com>
	<cf43d6de-617f-83c0-8c14-740c3fa23795@2ndquadrant.com>
	<B3AF05D4-A312-4988-BC5F-256E756C43CB@gmail.com>
	<63aa9ad9-cebd-a842-ea50-7f99b94443cd@2ndquadrant.com>
	<0938F717-F4A0-4568-83B4-80A19887EA25@gmail.com>

Mark Dilger <hornschnorter@gmail.com> writes:
>> On Nov 25, 2017, at 3:33 PM, Tomas Vondra <tomas.vondra@2ndquadrant.com> 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 used.  For
> conditions that can happen through (mis)use by the user, ereport is appropriate.

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




view thread (167+ messages)  latest in thread

Message-ID: <11942.1511663735@sss.pgh.pa.us>
Permalink:  ../11942.1511663735@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/11942.1511663735@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, hornschnorter@gmail.com, tomas.vondra@2ndquadrant.com, adrien.nayrat@dalibo.com
  Subject: Re: [HACKERS] PATCH: multivariate histograms and MCV lists
  In-Reply-To: <11942.1511663735@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox