Unused argument from execute_sql_string()
Hi,
I found that a argument "filename" is not used in execute_sql_string()
although the comment says "filename is used only to report errors.",
so I think we can remove this argument as done in the patch I attached.
Regards,
--
Yugo Nagata <nagata@sraoss.co.jp>
Attachments:
execute_sql_string.patchtext/x-diff; name=execute_sql_string.patchDownload
diff --git a/src/backend/commands/extension.c b/src/backend/commands/extension.c
index 2e4538146d..2d761a5773 100644
--- a/src/backend/commands/extension.c
+++ b/src/backend/commands/extension.c
@@ -683,8 +683,6 @@ read_extension_script_file(const ExtensionControlFile *control,
/*
* Execute given SQL string.
*
- * filename is used only to report errors.
- *
* Note: it's tempting to just use SPI to execute the string, but that does
* not work very well. The really serious problem is that SPI will parse,
* analyze, and plan the whole string before executing any of it; of course
@@ -694,7 +692,7 @@ read_extension_script_file(const ExtensionControlFile *control,
* could be very long.
*/
static void
-execute_sql_string(const char *sql, const char *filename)
+execute_sql_string(const char *sql)
{
List *raw_parsetree_list;
DestReceiver *dest;
@@ -921,7 +919,7 @@ execute_extension_script(Oid extensionOid, ExtensionControlFile *control,
/* And now back to C string */
c_sql = text_to_cstring(DatumGetTextPP(t_sql));
- execute_sql_string(c_sql, filename);
+ execute_sql_string(c_sql);
}
PG_CATCH();
{
Hi,
I found that a argument "filename" is not used in execute_sql_string()
although the comment says "filename is used only to report errors.",
so I think we can remove this argument as done in the patch I attached.
It seems the "filename" argument has been there since the first
version of extension.c was committed. I don't know why it has been
left unused. Maybe someone thought someday he generates more fancy
error reports using it?
Anyway, considering it's a static function, chance of breaking
backward compatibility is minimum, I think.
So +1 to remove the unused argument.
Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp
On Thu, Sep 13, 2018 at 03:47:26PM +0900, Tatsuo Ishii wrote:
Anyway, considering it's a static function, chance of breaking
backward compatibility is minimum, I think.So +1 to remove the unused argument.
Same opinion and arguments here, so I have committed the patch.
--
Michael
On Thu, 13 Sep 2018 17:03:28 +0900
Michael Paquier <michael@paquier.xyz> wrote:
On Thu, Sep 13, 2018 at 03:47:26PM +0900, Tatsuo Ishii wrote:
Anyway, considering it's a static function, chance of breaking
backward compatibility is minimum, I think.So +1 to remove the unused argument.
Same opinion and arguments here, so I have committed the patch.
Thanks!
--
Yugo Nagata <nagata@sraoss.co.jp>