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: 2011-01-11 15:05:10
Message-ID: 4D2C71A6.10201@wulczer.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 28/12/10 12:25, Jan Urbański wrote:
> 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?

Trying a bit harder to make src/include/utils/errcodes.h a generated
file I found that it's included so early it makes the task not trivial
at all. postgres.h includes elog.h, which includes errcodes.h (after
defining the MAKE_SQLSTATE macro). I'm not sure how to proceed:

1) just give up on it, and keep on maintaining 3 places where new error
codes have to go
2) do not include errcodes.h in elog.h, move the MAKE_SQLSTATE
definition to the top of errcodes.h, guarded by a #ifndef MAKE_SQLSTATE,
fix every place that included elog.h and assumed it has the sqlstate
values to explicitly include errcodes.h. This means that you can still
define your own MAKE_SQLSTATE macro and then include errcodes.h if you
want to redefine what it does.
3) try to wire generating errcodes.h somewhere very early in the makefiles

My preference is 2) followed by 1), because 3) seems too horrible. But I
can understand if people will want to keep things as they are and just
forget about generating errcodes.h

Cheers,
Jan

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2011-01-11 16:11:37 Re: autogenerating error code lists (was Re: [COMMITTERS] pgsql: Add foreign data wrapper error code values for SQL/MED.)
Previous Message Magnus Hagander 2011-01-11 10:33:18 pgsql: Revert installation of gram.h in 8.3

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-01-11 15:12:03 Re: Bug in pg_describe_object
Previous Message Kevin Grittner 2011-01-11 14:53:31 Re: SSI patch version 8