0003-use-CREATE-FUNCTION-as-prosrc.patch
text/x-diff
Filename: 0003-use-CREATE-FUNCTION-as-prosrc.patch
Type: text/x-diff
Part: 2
Message:
Re: SQL-standard function body
Patch
Format: unified
Series: patch 0003
| File | + | − |
|---|---|---|
| src/backend/commands/functioncmds.c | 6 | 6 |
diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c
index e7cb5c65e9..73f9fe1f70 100644
--- a/src/backend/commands/functioncmds.c
+++ b/src/backend/commands/functioncmds.c
@@ -964,13 +964,13 @@ interpret_AS_clause(Oid languageOid, const char *languageName,
}
/*
- * We must put something in prosrc. For the moment, just record an
- * empty string. It might be useful to store the original text of the
- * CREATE FUNCTION statement --- but to make actual use of that in
- * error reports, we'd also have to adjust readfuncs.c to not throw
- * away node location fields when reading prosqlbody.
+ * Use the text of the CREATE FUNCTION statement as prosrc. Note that
+ * this might be more text than strictly necessary, if CREATE FUNCTION
+ * is part of a multi-statement string; but trimming it would require
+ * adjusting the location fields in prosqlbody, which seems like way
+ * more trouble than the case is worth.
*/
- *prosrc_str_p = pstrdup("");
+ *prosrc_str_p = pstrdup(queryString);
/* But we definitely don't need probin. */
*probin_str_p = NULL;