Commit 65919ec9 authored by Heikki Linnakangas's avatar Heikki Linnakangas

Move volatility, language, etc. modifiers before function body in the pg_dump

output for CREATE FUNCTION. This makes it easier to read especially if the
function body is long.

Original idea and patch by Greg Sabino Mullane, though this is a stripped
down version of that.
parent 3ccb2c59
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* by PostgreSQL * by PostgreSQL
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.492 2008/05/16 23:36:05 tgl Exp $ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.493 2008/07/01 11:46:48 heikki Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -6775,14 +6775,12 @@ dumpFunc(Archive *fout, FuncInfo *finfo) ...@@ -6775,14 +6775,12 @@ dumpFunc(Archive *fout, FuncInfo *finfo)
rettypename = getFormattedTypeName(finfo->prorettype, zeroAsOpaque); rettypename = getFormattedTypeName(finfo->prorettype, zeroAsOpaque);
appendPQExpBuffer(q, "CREATE FUNCTION %s ", funcsig); appendPQExpBuffer(q, "CREATE FUNCTION %s ", funcsig);
appendPQExpBuffer(q, "RETURNS %s%s\n %s\n LANGUAGE %s", appendPQExpBuffer(q, "RETURNS %s%s",
(proretset[0] == 't') ? "SETOF " : "", (proretset[0] == 't') ? "SETOF " : "",
rettypename, rettypename);
asPart->data,
fmtId(lanname));
free(rettypename); free(rettypename);
appendPQExpBuffer(q, "\n LANGUAGE %s", fmtId(lanname));
if (provolatile[0] != PROVOLATILE_VOLATILE) if (provolatile[0] != PROVOLATILE_VOLATILE)
{ {
if (provolatile[0] == PROVOLATILE_IMMUTABLE) if (provolatile[0] == PROVOLATILE_IMMUTABLE)
...@@ -6850,7 +6848,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) ...@@ -6850,7 +6848,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo)
appendStringLiteralAH(q, pos, fout); appendStringLiteralAH(q, pos, fout);
} }
appendPQExpBuffer(q, ";\n"); appendPQExpBuffer(q, "\n %s;\n", asPart->data);
ArchiveEntry(fout, finfo->dobj.catId, finfo->dobj.dumpId, ArchiveEntry(fout, finfo->dobj.catId, finfo->dobj.dumpId,
funcsig_tag, funcsig_tag,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment