Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-committerspgsql-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: generate-errcodes-table.pl
Description: text/x-perl (1.3 KB)
Attachment: generate-plerrcodes.pl
Description: text/x-perl (837 bytes)
Attachment: generate-errcodes.pl
Description: text/x-perl (752 bytes)
Attachment: errcodes.txt
Description: text/plain (28.3 KB)

In response to

Responses

pgsql-hackers by date

Next:From: Robert HaasDate: 2010-12-28 11:36:38
Subject: Re: SQL/MED - core functionality
Previous:From: Itagaki TakahiroDate: 2010-12-28 10:23:43
Subject: Re: SQL/MED - core functionality

pgsql-committers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group