X-Original-To: pgsql-hackers@postgresql.org Received: from bob.samurai.com (bob.samurai.com [205.207.28.75]) by postgresql.org (Postfix) with ESMTP id D2C17476340; Thu, 13 Mar 2003 16:39:32 -0500 (EST) Received: from DU150.N224.ResNet.QueensU.CA (DU150.N224.ResNet.QueensU.CA [130.15.224.150]) by bob.samurai.com (Postfix) with ESMTP id D0F131DF0; Thu, 13 Mar 2003 16:39:33 -0500 (EST) Subject: Re: Upgrading the backend's error-message infrastructure From: Neil Conway To: Tom Lane Cc: PostgreSQL Hackers , pgsql-interfaces@postgreSQL.org In-Reply-To: <9168.1047588660@sss.pgh.pa.us> References: <9168.1047588660@sss.pgh.pa.us> Content-Type: text/plain Organization: Message-Id: <1047591570.356.1854.camel@tokyo> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 Date: 13 Mar 2003 16:39:31 -0500 Content-Transfer-Encoding: 7bit X-Archive-Number: 200303/573 X-Sequence-Number: 36819 On Thu, 2003-03-13 at 15:51, Tom Lane wrote: > After digging through our many past discussions of what to do with error > messages, I have put together the following first-cut proposal. Great work, Tom! While we're effectively changing every elog call site in the backend, would it also be a good idea to adopt a standard for the format of error messages? (e.g. capitalization, grammar, etc.) > extern int errmsg_internal(const char *fmt, ...); > > Like errmsg() except that the first parameter is not subject to > gettext-ification. My thought is that this would be used for internal > can't-happen conditions; there's no need to make translators labor over > translating stuff like "eval_const_expressions: unexpected boolop %d", > nor even to make them think about whether they need to. If we wanted to get fancy, we could make use of the glibc ability to generate a back trace programatically: http://www.gnu.org/manual/glibc-2.2.5/html_node/Backtraces.html#Backtraces > In gcc-compiled > backends, the function name will be provided automatically by errstart, > but there will be some places where we need the name to be available even > in a non-gcc build. To be honest, I'd be sceptical whether there are enough platforms without *either* gcc or a C99 compiler that it's worthwhile worrying about them that much (all that is at stake is some backward compatibility, anyway). Cheers, Neil -- Neil Conway || PGP Key ID: DB3C29FC