Re: autogenerating error code lists (was Re: [COMMITTERS] pgsql: Add foreign data wrapper error code values for SQL/MED.)

From: Jan Urbański <wulczer(at)wulczer(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org, Shigeru HANADA <hanada(at)metrosystems(dot)co(dot)jp>
Subject: Re: autogenerating error code lists (was Re: [COMMITTERS] pgsql: Add foreign data wrapper error code values for SQL/MED.)
Date: 2010-12-28 11:25:48
Message-ID: 4D19C93C.5000703@wulczer.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 26/12/10 21:33, Jan Urbański wrote:
> On 26/12/10 21:17, Tom Lane wrote:
>> =?UTF-8?B?SmFuIFVyYmHFhHNraQ==?= <wulczer(at)wulczer(dot)org> writes:
>>> Makes sense. Wait, no, errcodes.sgml includes the entries for success
>>> and warnings, but the plpgsql conditions list does not. So we need a
>>> separate column to differentiate.
>>
>> OK. But not 0/1 please. Maybe 'E', 'W', or 'S' ? And again, fixed
>> width columns first, so something like
>>
>> sqlstate E/W/S errcode_macro_name plpgsql_condition_name
>>
>> where I guess we could still make the plpgsql condition name optional.
>
> All right, E/W/S sounds good. I'm actually faulty of a misnomer by
> calling the field plpgsql_condition_name. It's more like spec_name, and
> it will be used to generate plpgsql condition names for E entries and
> rows in errcodes.sgml for all entries.
>
> Remember that there will also be Section: lines there, because
> errcodes.sgml needs to know where particular the error classes start and
> end.

Here's the basic errcodes.txt file and three scripts to generate
errcodes.h, plerrcodes.h and part of errcodes.sgml.

I tried wiring it into the build system, but failed, I can't figure out
which Makefiles should be updated in order to make errcodes.h and
plerrcodes.h generated headers. Could someone help with that?

This will actually remove a few entries from plerrcodes.h, that were
aliases of other entries (like array_element_error which was an alias of
array_subscript_error). Since they did not appear in errcodes.sgml, it
shouldn't be a problem.

It also adds a forgotten entry for nonstandard_use_of_escape_character
in plerrcodes.h.

Cheers,
Jan

Attachment Content-Type Size
errcodes.txt text/plain 28.3 KB
generate-errcodes.pl text/x-perl 752 bytes
generate-plerrcodes.pl text/x-perl 837 bytes
generate-errcodes-table.pl text/x-perl 1.3 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2010-12-28 14:34:49 pgsql: Another fix for larger postmaster.pid files.
Previous Message Magnus Hagander 2010-12-28 09:46:17 pgsql: Fix list of functions that are restricted to superusers

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-12-28 11:36:38 Re: SQL/MED - core functionality
Previous Message Itagaki Takahiro 2010-12-28 10:23:43 Re: SQL/MED - core functionality