mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Default values for function arguments
Pavel Stehule, with some tweaks by Peter Eisentraut
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
* by PostgreSQL
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.505 2008/11/09 21:24:32 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.506 2008/12/04 17:51:27 petere Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -6733,13 +6733,15 @@ dumpFunc(Archive *fout, FuncInfo *finfo)
|
||||
PQExpBuffer delqry;
|
||||
PQExpBuffer asPart;
|
||||
PGresult *res;
|
||||
char *funcsig;
|
||||
char *funcsig; /* identity signature */
|
||||
char *funcfullsig; /* full signature */
|
||||
char *funcsig_tag;
|
||||
int ntups;
|
||||
char *proretset;
|
||||
char *prosrc;
|
||||
char *probin;
|
||||
char *funcargs;
|
||||
char *funciargs;
|
||||
char *funcresult;
|
||||
char *proallargtypes;
|
||||
char *proargmodes;
|
||||
@@ -6782,6 +6784,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo)
|
||||
appendPQExpBuffer(query,
|
||||
"SELECT proretset, prosrc, probin, "
|
||||
"pg_catalog.pg_get_function_arguments(oid) as funcargs, "
|
||||
"pg_catalog.pg_get_function_identity_arguments(oid) as funciargs, "
|
||||
"pg_catalog.pg_get_function_result(oid) as funcresult, "
|
||||
"provolatile, proisstrict, prosecdef, "
|
||||
"proconfig, procost, prorows, "
|
||||
@@ -6893,6 +6896,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo)
|
||||
if (g_fout->remoteVersion >= 80400)
|
||||
{
|
||||
funcargs = PQgetvalue(res, 0, PQfnumber(res, "funcargs"));
|
||||
funciargs = PQgetvalue(res, 0, PQfnumber(res, "funciargs"));
|
||||
funcresult = PQgetvalue(res, 0, PQfnumber(res, "funcresult"));
|
||||
proallargtypes = proargmodes = proargnames = NULL;
|
||||
}
|
||||
@@ -6901,7 +6905,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo)
|
||||
proallargtypes = PQgetvalue(res, 0, PQfnumber(res, "proallargtypes"));
|
||||
proargmodes = PQgetvalue(res, 0, PQfnumber(res, "proargmodes"));
|
||||
proargnames = PQgetvalue(res, 0, PQfnumber(res, "proargnames"));
|
||||
funcargs = funcresult = NULL;
|
||||
funcargs = funciargs = funcresult = NULL;
|
||||
}
|
||||
provolatile = PQgetvalue(res, 0, PQfnumber(res, "provolatile"));
|
||||
proisstrict = PQgetvalue(res, 0, PQfnumber(res, "proisstrict"));
|
||||
@@ -7007,11 +7011,19 @@ dumpFunc(Archive *fout, FuncInfo *finfo)
|
||||
}
|
||||
}
|
||||
|
||||
if (funcargs)
|
||||
funcsig = format_function_arguments(finfo, funcargs);
|
||||
/* funcargs and funciargs are supported from 8.4 */
|
||||
if (funciargs)
|
||||
{
|
||||
funcsig = format_function_arguments(finfo, funciargs);
|
||||
funcfullsig = format_function_arguments(finfo, funcargs);
|
||||
}
|
||||
else
|
||||
{
|
||||
funcsig = format_function_arguments_old(finfo, nallargs, allargtypes,
|
||||
argmodes, argnames);
|
||||
funcfullsig = funcsig;
|
||||
}
|
||||
|
||||
funcsig_tag = format_function_signature(finfo, false);
|
||||
|
||||
/*
|
||||
@@ -7021,7 +7033,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo)
|
||||
fmtId(finfo->dobj.namespace->dobj.name),
|
||||
funcsig);
|
||||
|
||||
appendPQExpBuffer(q, "CREATE FUNCTION %s ", funcsig);
|
||||
appendPQExpBuffer(q, "CREATE FUNCTION %s ", funcfullsig);
|
||||
if (funcresult)
|
||||
appendPQExpBuffer(q, "RETURNS %s", funcresult);
|
||||
else
|
||||
|
Reference in New Issue
Block a user