CREATE FUNCTION fixup for types of functions.

This commit is contained in:
Bruce Momjian 1997-09-24 15:36:36 +00:00
parent 77d514a550
commit 837f0cbea0
2 changed files with 11 additions and 9 deletions

View File

@ -21,7 +21,7 @@
* *
* *
* IDENTIFICATION * 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 * Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
* *
@ -59,6 +59,7 @@
#include "postgres.h" #include "postgres.h"
#include "access/htup.h" #include "access/htup.h"
#include "catalog/pg_type.h" #include "catalog/pg_type.h"
#include "catalog/pg_language.h"
#include "catalog/pg_index.h" #include "catalog/pg_index.h"
#include "libpq-fe.h" #include "libpq-fe.h"
#ifndef HAVE_STRDUP #ifndef HAVE_STRDUP
@ -1238,7 +1239,7 @@ getFuncs(int *numFuncs)
finfo[i].prorettype = strdup(PQgetvalue(res, i, i_prorettype)); finfo[i].prorettype = strdup(PQgetvalue(res, i, i_prorettype));
finfo[i].retset = (strcmp(PQgetvalue(res, i, i_proretset), "t") == 0); finfo[i].retset = (strcmp(PQgetvalue(res, i, i_proretset), "t") == 0);
finfo[i].nargs = atoi(PQgetvalue(res, i, i_pronargs)); 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)); finfo[i].usename = strdup(PQgetvalue(res, i, i_usename));
@ -1717,8 +1718,12 @@ dumpOneFunc(FILE *fout, FuncInfo *finfo, int i,
q, q,
(finfo[i].retset) ? " SETOF " : "", (finfo[i].retset) ? " SETOF " : "",
findTypeByOid(tinfo, numTypes, finfo[i].prorettype), findTypeByOid(tinfo, numTypes, finfo[i].prorettype),
(finfo[i].lang) ? finfo[i].probin : finfo[i].prosrc, (finfo[i].lang == INTERNALlanguageId) ? finfo[i].prosrc :
(finfo[i].lang) ? "C" : "SQL"); (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); fputs(q, fout);

View File

@ -5,7 +5,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * 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 * Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
* *
@ -49,7 +49,7 @@ typedef struct _funcInfo
char *oid; char *oid;
char *proname; char *proname;
char *proowner; char *proowner;
int lang; /* 1 if C, else SQL */ int lang;
int nargs; int nargs;
char *argtypes[8]; /* should be derived from obj/fmgr.h char *argtypes[8]; /* should be derived from obj/fmgr.h
* instead of hardwired */ * instead of hardwired */
@ -232,6 +232,3 @@ dumpIndices(FILE *fout, IndInfo *indinfo, int numIndices,
/* largest query string size */ /* largest query string size */
#define MAXQUERYLEN 5000 #define MAXQUERYLEN 5000
/* these voodoo constants are from the backend */
#define C_PROLANG_OID 13