From 837f0cbea02dab7cc50dc44a322be58fb105cfb1 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Wed, 24 Sep 1997 15:36:36 +0000
Subject: [PATCH] CREATE FUNCTION fixup for types of functions.

---
 src/bin/pg_dump/pg_dump.c | 13 +++++++++----
 src/bin/pg_dump/pg_dump.h |  7 ++-----
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 9de9dfc97eb..ef432e15271 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -21,7 +21,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.46 1997/09/24 15:14:02 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.47 1997/09/24 15:36:34 momjian Exp $
  *
  * Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
  *
@@ -59,6 +59,7 @@
 #include "postgres.h"
 #include "access/htup.h"
 #include "catalog/pg_type.h"
+#include "catalog/pg_language.h"
 #include "catalog/pg_index.h"
 #include "libpq-fe.h"
 #ifndef HAVE_STRDUP
@@ -1238,7 +1239,7 @@ getFuncs(int *numFuncs)
 		finfo[i].prorettype = strdup(PQgetvalue(res, i, i_prorettype));
 		finfo[i].retset = (strcmp(PQgetvalue(res, i, i_proretset), "t") == 0);
 		finfo[i].nargs = atoi(PQgetvalue(res, i, i_pronargs));
-		finfo[i].lang = (atoi(PQgetvalue(res, i, i_prolang)) == C_PROLANG_OID);
+		finfo[i].lang = atoi(PQgetvalue(res, i, i_prolang));
 
 		finfo[i].usename = strdup(PQgetvalue(res, i, i_usename));
 
@@ -1717,8 +1718,12 @@ dumpOneFunc(FILE *fout, FuncInfo *finfo, int i,
 			q,
 			(finfo[i].retset) ? " SETOF " : "",
 			findTypeByOid(tinfo, numTypes, finfo[i].prorettype),
-			(finfo[i].lang) ? finfo[i].probin : finfo[i].prosrc,
-			(finfo[i].lang) ? "C" : "SQL");
+			(finfo[i].lang == INTERNALlanguageId) ? finfo[i].prosrc :
+				(finfo[i].lang == ClanguageId) ? finfo[i].probin :
+					(finfo[i].lang == SQLlanguageId) ? finfo[i].prosrc : "unknown");
+			(finfo[i].lang == INTERNALlanguageId) ? "INTERNAL" :
+				(finfo[i].lang == ClanguageId) ? "C" :
+					(finfo[i].lang == SQLlanguageId) ? "SQL" : "unknown");
 
 	fputs(q, fout);
 
diff --git a/src/bin/pg_dump/pg_dump.h b/src/bin/pg_dump/pg_dump.h
index 63180d6c26d..0e7ce3e619a 100644
--- a/src/bin/pg_dump/pg_dump.h
+++ b/src/bin/pg_dump/pg_dump.h
@@ -5,7 +5,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_dump.h,v 1.23 1997/09/08 21:49:59 momjian Exp $
+ * $Id: pg_dump.h,v 1.24 1997/09/24 15:36:36 momjian Exp $
  *
  * Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
  *
@@ -49,7 +49,7 @@ typedef struct _funcInfo
 	char	   *oid;
 	char	   *proname;
 	char	   *proowner;
-	int			lang;			/* 1 if C, else SQL */
+	int			lang;
 	int			nargs;
 	char	   *argtypes[8];	/* should be derived from obj/fmgr.h
 								 * instead of hardwired */
@@ -232,6 +232,3 @@ dumpIndices(FILE *fout, IndInfo *indinfo, int numIndices,
 
 /* largest query string size */
 #define MAXQUERYLEN  5000
-
-/* these voodoo constants are from the backend */
-#define C_PROLANG_OID		13
-- 
GitLab