Skip to content

Commit 74e3311

Browse files
committed
- Support for iscachable when dumping functions
1 parent 7f6e021 commit 74e3311

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*
2323
*
2424
* IDENTIFICATION
25-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.162 2000/08/01 15:51:44 pjw Exp $
25+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.163 2000/08/07 12:32:54 pjw Exp $
2626
*
2727
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
2828
*
@@ -1714,13 +1714,15 @@ getFuncs(int *numFuncs)
17141714
int i_proretset;
17151715
int i_prosrc;
17161716
int i_probin;
1717+
int i_iscachable;
17171718
int i_usename;
17181719

17191720
/* find all user-defined funcs */
17201721

17211722
appendPQExpBuffer(query,
17221723
"SELECT pg_proc.oid, proname, prolang, pronargs, prorettype, "
1723-
"proretset, proargtypes, prosrc, probin, usename "
1724+
"proretset, proargtypes, prosrc, probin, usename, "
1725+
"proiscachable "
17241726
"from pg_proc, pg_user "
17251727
"where pg_proc.oid > '%u'::oid and proowner = usesysid",
17261728
g_last_builtin_oid);
@@ -1751,6 +1753,7 @@ getFuncs(int *numFuncs)
17511753
i_proretset = PQfnumber(res, "proretset");
17521754
i_prosrc = PQfnumber(res, "prosrc");
17531755
i_probin = PQfnumber(res, "probin");
1756+
i_iscachable = PQfnumber(res, "proiscachable");
17541757
i_usename = PQfnumber(res, "usename");
17551758

17561759
for (i = 0; i < ntups; i++)
@@ -1766,6 +1769,7 @@ getFuncs(int *numFuncs)
17661769
finfo[i].nargs = atoi(PQgetvalue(res, i, i_pronargs));
17671770
finfo[i].lang = atoi(PQgetvalue(res, i, i_prolang));
17681771
finfo[i].usename = strdup(PQgetvalue(res, i, i_usename));
1772+
finfo[i].iscachable = (strcmp(PQgetvalue(res, i, i_iscachable),"t") == 0);
17691773
if (finfo[i].nargs < 0 || finfo[i].nargs > FUNC_MAX_ARGS)
17701774
{
17711775
fprintf(stderr, "failed sanity check: %s has %d args\n",
@@ -2923,11 +2927,18 @@ dumpOneFunc(Archive *fout, FuncInfo *finfo, int i,
29232927

29242928
resetPQExpBuffer(q);
29252929
appendPQExpBuffer(q, "CREATE FUNCTION %s ", fn->data );
2926-
appendPQExpBuffer(q, "RETURNS %s%s %s LANGUAGE '%s';\n",
2930+
appendPQExpBuffer(q, "RETURNS %s%s %s LANGUAGE '%s'",
29272931
(finfo[i].retset) ? " SETOF " : "",
29282932
fmtId(findTypeByOid(tinfo, numTypes, finfo[i].prorettype), false),
29292933
asPart->data, func_lang);
29302934

2935+
if (finfo[i].iscachable) /* OR in new attrs here */
2936+
{
2937+
appendPQExpBuffer(q, " WITH (iscachable)");
2938+
}
2939+
2940+
appendPQExpBuffer(q, ";\n");
2941+
29312942
ArchiveEntry(fout, finfo[i].oid, fn->data, "FUNCTION", NULL, q->data, delqry->data,
29322943
"", finfo[i].usename, NULL, NULL);
29332944

src/bin/pg_dump/pg_dump.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: pg_dump.h,v 1.50 2000/07/17 03:05:20 tgl Exp $
9+
* $Id: pg_dump.h,v 1.51 2000/08/07 12:32:54 pjw Exp $
1010
*
1111
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
1212
*
@@ -62,6 +62,7 @@ typedef struct _funcInfo
6262
char *prosrc;
6363
char *probin;
6464
char *usename;
65+
int iscachable; /* Attr */
6566
int dumped; /* 1 if already dumped */
6667
} FuncInfo;
6768

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy