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-26 20:33:24
Message-ID: 4D17A694.1080203@wulczer.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

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.

So:

sqlstate E/W/S errcode_macro_name spec_name

where spec_name is lowercase and underscore-separated.

errcodes.h would be generated by splitting sqlstate into letters and
emitting `#define errcode_macro_name MAKE_SQLSTATE('x','x','x','x','x')'

plerrcodes.h would be generated by emitting `{ "spec_name",
errcode_macro_name },' for each E line

errcodes.sgml would be generated by emitting a <row/> element with
sqlstate, spec_name in uppercase and with underscores stripped and just
spec_name. The Section: lines would generate table headers.

... and spiexceptions.h in plpython would be "spec_name" with
underscores converted to camel case and errcode_macro_name

How does that sound?

Jan

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2010-12-26 21:18:23 Re: Re: [COMMITTERS] pgsql: Add foreign data wrapper error code values for SQL/MED.
Previous Message Robert Haas 2010-12-26 20:27:11 Re: Re: [COMMITTERS] pgsql: Add foreign data wrapper error code values for SQL/MED.

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-12-26 20:41:46 Re: knngist - 0.8
Previous Message Robert Haas 2010-12-26 20:27:11 Re: Re: [COMMITTERS] pgsql: Add foreign data wrapper error code values for SQL/MED.