From f192e4a5d0a041a5353d43fa10b6fe675a1c01fa Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Tue, 4 Aug 2009 04:04:12 +0000
Subject: [PATCH] Cause pg_proc.probin to be declared as text, not bytea. 
 Everything was already treating it as text anyway, to the point that I
 couldn't find anything to change except the datatype markings in catalog/*.h.
  The only effect that the bytea declaration had was to cause byteaout() to be
 invoked when pg_dump (or another client program) inspected the column value. 
 Since pg_dump wasn't expecting that, but just treating what it got as text,
 the net result is that dump and reload would mangle any backslashes or
 non-ASCII characters in the filename string for a C-language function.  That
 is a very long-standing bug, but given the lack of field complaints it
 doesn't seem worth trying to find a back-patchable fix.  We'll just make this
 change to fix it going forward.

This change will also forestall problems after the planned change to let bytea
emit hex output instead of escaped characters.
---
 doc/src/sgml/catalogs.sgml         | 4 ++--
 src/include/catalog/catversion.h   | 4 ++--
 src/include/catalog/pg_attribute.h | 6 +++---
 src/include/catalog/pg_proc.h      | 4 ++--
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 6cca9749817..46ac8c39442 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.204 2009/08/02 22:14:51 tgl Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.205 2009/08/04 04:04:11 tgl Exp $ -->
 <!--
  Documentation of the system catalogs, directed toward PostgreSQL developers
  -->
@@ -3841,7 +3841,7 @@
 
      <row>
       <entry><structfield>probin</structfield></entry>
-      <entry><type>bytea</type></entry>
+      <entry><type>text</type></entry>
       <entry></entry>
       <entry>
        Additional information about how to invoke the function.
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index c1b8f6b6a89..fb6a2d25eb2 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -37,7 +37,7 @@
  * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.536 2009/08/03 21:11:39 joe Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.537 2009/08/04 04:04:11 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -53,6 +53,6 @@
  */
 
 /*							yyyymmddN */
-#define CATALOG_VERSION_NO	200908031
+#define CATALOG_VERSION_NO	200908032
 
 #endif
diff --git a/src/include/catalog/pg_attribute.h b/src/include/catalog/pg_attribute.h
index ce6da9acdf4..ff5ed5981fe 100644
--- a/src/include/catalog/pg_attribute.h
+++ b/src/include/catalog/pg_attribute.h
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/catalog/pg_attribute.h,v 1.150 2009/08/02 22:14:52 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_attribute.h,v 1.151 2009/08/04 04:04:11 tgl Exp $
  *
  * NOTES
  *	  the genbki.sh script reads this file and generates .bki
@@ -312,7 +312,7 @@ DATA(insert ( 1247 tableoid			26 0 0  4  -7 0 -1 -1 t p i t f f t 0 _null_));
 { 1255, {"proargnames"},	  1009, -1, 0, -1, 20, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, { 0 } }, \
 { 1255, {"proargdefaults"},		25, -1, 0, -1, 21, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0, { 0 } }, \
 { 1255, {"prosrc"},				25, -1, 0, -1, 22, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0, { 0 } }, \
-{ 1255, {"probin"},				17, -1, 0, -1, 23, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0, { 0 } }, \
+{ 1255, {"probin"},				25, -1, 0, -1, 23, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0, { 0 } }, \
 { 1255, {"proconfig"},		  1009, -1, 0, -1, 24, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, { 0 } }, \
 { 1255, {"proacl"},			  1034, -1, 0, -1, 25, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, { 0 } }
 
@@ -338,7 +338,7 @@ DATA(insert ( 1255 proargmodes	  1002 -1 0 -1 19 1 -1 -1 f x i f f f t 0 _null_)
 DATA(insert ( 1255 proargnames	  1009 -1 0 -1 20 1 -1 -1 f x i f f f t 0 _null_));
 DATA(insert ( 1255 proargdefaults	25 -1 0 -1 21 0 -1 -1 f x i f f f t 0 _null_));
 DATA(insert ( 1255 prosrc			25 -1 0 -1 22 0 -1 -1 f x i f f f t 0 _null_));
-DATA(insert ( 1255 probin			17 -1 0 -1 23 0 -1 -1 f x i f f f t 0 _null_));
+DATA(insert ( 1255 probin			25 -1 0 -1 23 0 -1 -1 f x i f f f t 0 _null_));
 DATA(insert ( 1255 proconfig	  1009 -1 0 -1 24 1 -1 -1 f x i f f f t 0 _null_));
 DATA(insert ( 1255 proacl		  1034 -1 0 -1 25 1 -1 -1 f x i f f f t 0 _null_));
 DATA(insert ( 1255 ctid				27 0 0  6  -1 0 -1 -1 f p s t f f t 0 _null_));
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h
index 89effab1491..d24f3681219 100644
--- a/src/include/catalog/pg_proc.h
+++ b/src/include/catalog/pg_proc.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.548 2009/08/03 21:11:39 joe Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.549 2009/08/04 04:04:12 tgl Exp $
  *
  * NOTES
  *	  The script catalog/genbki.sh reads this file and generates .bki
@@ -59,7 +59,7 @@ CATALOG(pg_proc,1255) BKI_BOOTSTRAP
 	text		proargdefaults; /* list of expression trees for argument
 								 * defaults (NULL if none) */
 	text		prosrc;			/* procedure source text */
-	bytea		probin;			/* secondary procedure info (can be NULL) */
+	text		probin;			/* secondary procedure info (can be NULL) */
 	text		proconfig[1];	/* procedure-local GUC settings */
 	aclitem		proacl[1];		/* access permissions */
 } FormData_pg_proc;
-- 
GitLab