0001-Install-errcodes.txt-for-use-by-extensions-v2.patch

application/octet-stream

Filename: 0001-Install-errcodes.txt-for-use-by-extensions-v2.patch
Type: application/octet-stream
Part: 0
Message: Re: Unrecognized exception condition "deprecated_feature"

Patch

Format: format-patch
Series: patch v2-0001
Subject: Install errcodes.txt for use by extensions.
File+
src/backend/Makefile 2 0
src/backend/utils/Makefile 10 0
src/tools/msvc/Install.pm 3 0
From bb6dcf562ea6d7e1c64f30b6e162423dc0314a6b Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@enterprisedb.com>
Date: Thu, 29 Mar 2018 13:28:52 +1300
Subject: [PATCH] Install errcodes.txt for use by extensions.

Maintainers of out-of-tree PLs typically need access to the set of error
codes.  To avoid the need to duplicate that information in some form in PL
source trees, provide errcodes.txt as part of a server installation.

Thomas Munro, based on a suggestion from Andrew Gierth
Discussion: https://postgr.es/m/87woykk7mu.fsf%40news-spur.riddles.org.uk
---
 src/backend/Makefile       |  2 ++
 src/backend/utils/Makefile | 10 ++++++++++
 src/tools/msvc/Install.pm  |  3 +++
 3 files changed, 15 insertions(+)

diff --git a/src/backend/Makefile b/src/backend/Makefile
index 21b094385f..a4b6d1658c 100644
--- a/src/backend/Makefile
+++ b/src/backend/Makefile
@@ -247,6 +247,7 @@ endif
 endif
 	$(MAKE) -C catalog install-data
 	$(MAKE) -C tsearch install-data
+	$(MAKE) -C utils install-data
 	$(INSTALL_DATA) $(srcdir)/libpq/pg_hba.conf.sample '$(DESTDIR)$(datadir)/pg_hba.conf.sample'
 	$(INSTALL_DATA) $(srcdir)/libpq/pg_ident.conf.sample '$(DESTDIR)$(datadir)/pg_ident.conf.sample'
 	$(INSTALL_DATA) $(srcdir)/utils/misc/postgresql.conf.sample '$(DESTDIR)$(datadir)/postgresql.conf.sample'
@@ -312,6 +313,7 @@ endif
 endif
 	$(MAKE) -C catalog uninstall-data
 	$(MAKE) -C tsearch uninstall-data
+	$(MAKE) -C utils uninstall-data
 	rm -f '$(DESTDIR)$(datadir)/pg_hba.conf.sample' \
 	      '$(DESTDIR)$(datadir)/pg_ident.conf.sample' \
 	      '$(DESTDIR)$(datadir)/postgresql.conf.sample' \
diff --git a/src/backend/utils/Makefile b/src/backend/utils/Makefile
index e296e6ce4d..163c81a1c2 100644
--- a/src/backend/utils/Makefile
+++ b/src/backend/utils/Makefile
@@ -46,6 +46,16 @@ else
 	sed -f $(srcdir)/Gen_dummy_probes.sed $< >$@
 endif
 
+.PHONY: install-data
+install-data: errcodes.txt installdirs
+	$(INSTALL_DATA) $(srcdir)/errcodes.txt '$(DESTDIR)$(datadir)/errcodes.txt'
+
+installdirs:
+	$(MKDIR_P) '$(DESTDIR)$(datadir)'
+
+.PHONY: uninstall-data
+uninstall-data:
+	rm -f $(addprefix '$(DESTDIR)$(datadir)'/, errcodes.txt)
 
 # fmgroids.h, fmgrprotos.h, fmgrtab.c and errcodes.h are in the
 # distribution tarball, so they are not cleaned here.
diff --git a/src/tools/msvc/Install.pm b/src/tools/msvc/Install.pm
index 8f3cc173c5..be67d8adbb 100644
--- a/src/tools/msvc/Install.pm
+++ b/src/tools/msvc/Install.pm
@@ -134,6 +134,9 @@ sub Install
 		CopyFiles(
 			'Information schema data', $target . '/share/',
 			'src/backend/catalog/',    'sql_features.txt');
+		CopyFiles(
+			'Error code data', $target . '/share/',
+			'src/backend/utils/',    'errcodes.txt');
 		GenerateConversionScript($target);
 		GenerateTimezoneFiles($target, $conf);
 		GenerateTsearchFiles($target);
-- 
2.16.2