Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit74e3311

Browse files
committed
- Support for iscachable when dumping functions
1 parent7f6e021 commit74e3311

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
inti_proretset;
17151715
inti_prosrc;
17161716
inti_probin;
1717+
inti_iscachable;
17171718
inti_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+
intiscachable;/* Attr */
6566
intdumped;/* 1 if already dumped */
6667
}FuncInfo;
6768

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp