1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-24 00:23:06 +03:00

Add ABI extra field to fmgr magic block

This allows derived products to intentionally make their fmgr ABI
incompatible, with a clean error message.

Discussion: https://www.postgresql.org/message-id/flat/55215fda-db31-a045-d6b7-d6f2d2dc9920%40enterprisedb.com
This commit is contained in:
Peter Eisentraut
2021-11-22 07:40:17 +01:00
parent 1b06d7bac9
commit d6d1dfcc99
3 changed files with 38 additions and 1 deletions

View File

@@ -330,6 +330,21 @@ incompatible_module_error(const char *libname,
magic_data.version / 100, library_version)));
}
/*
* Similarly, if the ABI extra field doesn't match, error out. Other
* fields below might also mismatch, but that isn't useful information if
* you're using the wrong product altogether.
*/
if (strcmp(module_magic_data->abi_extra, magic_data.abi_extra) != 0)
{
ereport(ERROR,
(errmsg("incompatible library \"%s\": ABI mismatch",
libname),
errdetail("Server has ABI \"%s\", library has \"%s\".",
magic_data.abi_extra,
module_magic_data->abi_extra)));
}
/*
* Otherwise, spell out which fields don't agree.
*