On Wed, Jan 12, 2011 at 5:10 PM, Jan Urbański <wulc...@wulczer.org> wrote:
> On 12/01/11 19:57, Jan Urbański wrote:
>> On 11/01/11 21:21, Jan Urbański wrote:
>>> On 11/01/11 18:59, Tom Lane wrote:
>>>> =?UTF-8?B?SmFuIFVyYmHFhHNraQ==?= <wulc...@wulczer.org> writes:
>>>>> On 11/01/11 17:11, Tom Lane wrote:
>>>> Peter would probably be a better person than me to answer that, but I
>>>> imagine that what you want is similar to what src/backend/Makefile does
>>>> for parser/gram.h, only applied at the src/ level or maybe even the
>>>> root.
>>
>>> And actually, if I change my rule to read:
>>>
>>> $(SUBDIRS:%=all-%-recurse): $(top_builddir)/src/include/utils/errcodes.h
>>>
>>> it works. Now whether that's acceptable or not is another thing entirely...
>>
>> And so I came up with three patches to make errcodes.h, plerrcodes.h and
>> errcodes.sgml (respectively) generated files.
>
> Darn, forgot about MSVC again. See
> http://archives.postgresql.org/message-id/4d2df996.9000...@wulczer.org
> for details on how this works.
>
> Attached are the previous 3 patches and a fourth one that adds MSVC support.

I think these look good.  I'm not sure there's any value in stripping
the duplicates out of plerrcodes.h, though, even if they were
undocumented:

-       "array_element_error", ERRCODE_ARRAY_ELEMENT_ERROR
-       "datetime_value_out_of_range", ERRCODE_DATETIME_VALUE_OUT_OF_RANGE
-       "undefined_cursor", ERRCODE_UNDEFINED_CURSOR
-       "undefined_database", ERRCODE_UNDEFINED_DATABASE
-       "undefined_pstatement", ERRCODE_UNDEFINED_PSTATEMENT
-       "undefined_schema", ERRCODE_UNDEFINED_SCHEMA

I'm attaching a few other proposed adjustments.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/doc/src/sgml/.gitignore b/doc/src/sgml/.gitignore
index 62a38d2..e1b84b4 100644
--- a/doc/src/sgml/.gitignore
+++ b/doc/src/sgml/.gitignore
@@ -16,6 +16,7 @@
 # GENERATED_SGML
 /features-supported.sgml
 /features-unsupported.sgml
+/errcodes-table.sgml
 /version.sgml
 /bookindex.sgml
 /HTML.index
diff --git a/doc/src/sgml/Makefile b/doc/src/sgml/Makefile
index 59d8692..fe70d8e 100644
--- a/doc/src/sgml/Makefile
+++ b/doc/src/sgml/Makefile
@@ -137,7 +137,7 @@ features-unsupported.sgml: $(top_srcdir)/src/backend/catalog/sql_feature_package
 	$(PERL) $(srcdir)/mk_feature_tables.pl NO $^ > $@
 
 errcodes-table.sgml: $(top_srcdir)/src/include/utils/errcodes.txt generate-errcodes-table.pl
-	$(PERL) generate-errcodes-table.pl $< > $@
+	$(PERL) $(srcdir)/generate-errcodes-table.pl $< > $@
 
 ##
 ## Print
diff --git a/src/backend/utils/.gitignore b/src/backend/utils/.gitignore
index fd00851..5c3a565 100644
--- a/src/backend/utils/.gitignore
+++ b/src/backend/utils/.gitignore
@@ -1,3 +1,4 @@
 /fmgrtab.c
 /fmgroids.h
 /probes.h
+/errcodes.h
diff --git a/src/backend/utils/generate-errcodes.pl b/src/backend/utils/generate-errcodes.pl
index 592ad66..3469f19 100644
--- a/src/backend/utils/generate-errcodes.pl
+++ b/src/backend/utils/generate-errcodes.pl
@@ -17,10 +17,15 @@ while (<$errcodes>) {
     next if /^#/;
     next if /^\s*$/;
 
-    # Skip section headers
-    next if /^Section:/;
-
-    die unless /^([^\s]{5})\s+[EWS]\s+([^\s]+)/;
+    # Omit a comment for each section header
+    if (/^Section:(.*)/) {
+		my $header = $1;
+		$header =~ s/^\s+//;
+		print "\n/* $header */\n";
+		next;
+	}
+
+    die "unable to parse errcodes.txt" unless /^([^\s]{5})\s+[EWS]\s+([^\s]+)/;
 
     (my $sqlstate, my $errcode_macro) = ($1, $2);
 
diff --git a/src/include/utils/.gitignore b/src/include/utils/.gitignore
index c7c402b..808826d 100644
--- a/src/include/utils/.gitignore
+++ b/src/include/utils/.gitignore
@@ -1,2 +1,3 @@
 /fmgroids.h
 /probes.h
+/errcodes.h
diff --git a/src/pl/plpgsql/src/.gitignore b/src/pl/plpgsql/src/.gitignore
index 2eecb0f..92387fa 100644
--- a/src/pl/plpgsql/src/.gitignore
+++ b/src/pl/plpgsql/src/.gitignore
@@ -1,2 +1,3 @@
 /pl_gram.c
 /pl_gram.h
+/plerrcodes.h
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to