Move volatility, language, etc. modifiers before function body in the pg_dump
authorHeikki Linnakangas <heikki@enterprisedb.com>
Tue, 1 Jul 2008 11:46:48 +0000 (11:46 +0000)
committerHeikki Linnakangas <heikki@enterprisedb.com>
Tue, 1 Jul 2008 11:46:48 +0000 (11:46 +0000)
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.

src/bin/pg_dump/pg_dump.c

index 91e32e32c52b2eea2e2802e1f69a9f106a58d8e3..79604d495190cfc44503348c64d2a15016054e86 100644 (file)
@@ -6775,14 +6775,12 @@ dumpFunc(Archive *fout, FuncInfo *finfo)
        rettypename = getFormattedTypeName(finfo->prorettype, zeroAsOpaque);
 
        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 " : "",
-                                         rettypename,
-                                         asPart->data,
-                                         fmtId(lanname));
-
+                                         rettypename);
        free(rettypename);
 
+       appendPQExpBuffer(q, "\n    LANGUAGE %s", fmtId(lanname));
        if (provolatile[0] != PROVOLATILE_VOLATILE)
        {
                if (provolatile[0] == PROVOLATILE_IMMUTABLE)
@@ -6850,7 +6848,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo)
                        appendStringLiteralAH(q, pos, fout);
        }
 
-       appendPQExpBuffer(q, ";\n");
+       appendPQExpBuffer(q, "\n    %s;\n", asPart->data);
 
        ArchiveEntry(fout, finfo->dobj.catId, finfo->dobj.dumpId,
                                 funcsig_tag,