mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Introduce PG_MODULE_MAGIC_EXT macro.
This macro allows dynamically loaded shared libraries (modules) to provide a wired-in module name and version, and possibly other compile-time-constant fields in future. This information can be retrieved with the new pg_get_loaded_modules() function. This feature is expected to be particularly useful for modules that do not have any exposed SQL functionality and thus are not associated with a SQL-level extension object. But even for modules that do belong to extensions, being able to verify the actual code version can be useful. Author: Andrei Lepikhov <lepihov@gmail.com> Reviewed-by: Yurii Rashkovskii <yrashk@omnigres.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/dd4d1b59-d0fe-49d5-b28f-1e463b68fa32@gmail.com
This commit is contained in:
@ -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();
|
||||
|
Reference in New Issue
Block a user