22
22
*
23
23
*
24
24
* 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 $
26
26
*
27
27
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
28
28
*
@@ -1714,13 +1714,15 @@ getFuncs(int *numFuncs)
1714
1714
int i_proretset ;
1715
1715
int i_prosrc ;
1716
1716
int i_probin ;
1717
+ int i_iscachable ;
1717
1718
int i_usename ;
1718
1719
1719
1720
/* find all user-defined funcs */
1720
1721
1721
1722
appendPQExpBuffer (query ,
1722
1723
"SELECT pg_proc.oid, proname, prolang, pronargs, prorettype, "
1723
- "proretset, proargtypes, prosrc, probin, usename "
1724
+ "proretset, proargtypes, prosrc, probin, usename, "
1725
+ "proiscachable "
1724
1726
"from pg_proc, pg_user "
1725
1727
"where pg_proc.oid > '%u'::oid and proowner = usesysid" ,
1726
1728
g_last_builtin_oid );
@@ -1751,6 +1753,7 @@ getFuncs(int *numFuncs)
1751
1753
i_proretset = PQfnumber (res ,"proretset" );
1752
1754
i_prosrc = PQfnumber (res ,"prosrc" );
1753
1755
i_probin = PQfnumber (res ,"probin" );
1756
+ i_iscachable = PQfnumber (res ,"proiscachable" );
1754
1757
i_usename = PQfnumber (res ,"usename" );
1755
1758
1756
1759
for (i = 0 ;i < ntups ;i ++ )
@@ -1766,6 +1769,7 @@ getFuncs(int *numFuncs)
1766
1769
finfo [i ].nargs = atoi (PQgetvalue (res ,i ,i_pronargs ));
1767
1770
finfo [i ].lang = atoi (PQgetvalue (res ,i ,i_prolang ));
1768
1771
finfo [i ].usename = strdup (PQgetvalue (res ,i ,i_usename ));
1772
+ finfo [i ].iscachable = (strcmp (PQgetvalue (res ,i ,i_iscachable ),"t" )== 0 );
1769
1773
if (finfo [i ].nargs < 0 || finfo [i ].nargs > FUNC_MAX_ARGS )
1770
1774
{
1771
1775
fprintf (stderr ,"failed sanity check: %s has %d args\n" ,
@@ -2923,11 +2927,18 @@ dumpOneFunc(Archive *fout, FuncInfo *finfo, int i,
2923
2927
2924
2928
resetPQExpBuffer (q );
2925
2929
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'" ,
2927
2931
(finfo [i ].retset ) ?" SETOF " :"" ,
2928
2932
fmtId (findTypeByOid (tinfo ,numTypes ,finfo [i ].prorettype ), false),
2929
2933
asPart -> data ,func_lang );
2930
2934
2935
+ if (finfo [i ].iscachable )/* OR in new attrs here */
2936
+ {
2937
+ appendPQExpBuffer (q ," WITH (iscachable)" );
2938
+ }
2939
+
2940
+ appendPQExpBuffer (q ,";\n" );
2941
+
2931
2942
ArchiveEntry (fout ,finfo [i ].oid ,fn -> data ,"FUNCTION" ,NULL ,q -> data ,delqry -> data ,
2932
2943
"" ,finfo [i ].usename ,NULL ,NULL );
2933
2944