diff options
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/auto_explain/auto_explain.c | 5 | ||||
-rw-r--r-- | contrib/auto_explain/t/001_auto_explain.pl | 13 |
2 files changed, 17 insertions, 1 deletions
diff --git a/contrib/auto_explain/auto_explain.c b/contrib/auto_explain/auto_explain.c index 3b73bd19107..cd6625020a7 100644 --- a/contrib/auto_explain/auto_explain.c +++ b/contrib/auto_explain/auto_explain.c @@ -22,7 +22,10 @@ #include "executor/instrument.h" #include "utils/guc.h" -PG_MODULE_MAGIC; +PG_MODULE_MAGIC_EXT( + .name = "auto_explain", + .version = PG_VERSION +); /* GUC variables */ static int auto_explain_log_min_duration = -1; /* msec or -1 */ diff --git a/contrib/auto_explain/t/001_auto_explain.pl b/contrib/auto_explain/t/001_auto_explain.pl index 25252604b7d..6af5ac1da18 100644 --- a/contrib/auto_explain/t/001_auto_explain.pl +++ b/contrib/auto_explain/t/001_auto_explain.pl @@ -212,4 +212,17 @@ REVOKE SET ON PARAMETER auto_explain.log_format FROM regress_user1; DROP USER regress_user1; }); +# Test pg_get_loaded_modules() function. This function is particularly +# useful for modules with no SQL presence, such as auto_explain. + +my $res = $node->safe_psql( + "postgres", q{ +SELECT module_name, + version = current_setting('server_version') as version_ok, + regexp_replace(file_name, '\..*', '') as file_name_stripped +FROM pg_get_loaded_modules() +WHERE module_name = 'auto_explain'; +}); +like($res, qr/^auto_explain\|t\|auto_explain$/, "pg_get_loaded_modules() ok"); + done_testing(); |