aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-05-31 20:58:09 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-05-31 20:58:09 +0000
commit8f165ee13b11baf17b91d858c535419c33a755d6 (patch)
tree24edff7fbb527e614b27305af7f5f44539f696f8 /src
parentc269f0f1e2c760dde7a2c95ab09f913fa2aef1c4 (diff)
downloadpostgresql-8f165ee13b11baf17b91d858c535419c33a755d6.tar.gz
postgresql-8f165ee13b11baf17b91d858c535419c33a755d6.zip
Make PG_MODULE_MAGIC required in shared libraries that are loaded into
the server. Per discussion, there seems no point in a waiting period before making this required.
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/fmgr/dfmgr.c18
-rw-r--r--src/include/fmgr.h12
-rw-r--r--src/tutorial/funcs.c4
3 files changed, 18 insertions, 16 deletions
diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c
index a54ca550dd7..0aacf2be995 100644
--- a/src/backend/utils/fmgr/dfmgr.c
+++ b/src/backend/utils/fmgr/dfmgr.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.84 2006/05/30 21:21:30 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.85 2006/05/31 20:58:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -188,14 +188,14 @@ load_external_function(char *filename, char *funcname,
}
else
{
- /*
- * Currently we do not reject modules for not having a
- * magic block, it would break every external module in
- * existence. At some point though, this will become an ERROR.
- */
- ereport(LOG,
- (errmsg("library \"%s\" does not have a magic block",
- fullname)));
+ /* try to unlink library */
+ pg_dlclose(file_scanner->handle);
+ free((char *) file_scanner);
+ /* complain */
+ ereport(ERROR,
+ (errmsg("incompatible library \"%s\": missing magic block",
+ fullname),
+ errhint("Extension libraries are now required to use the PG_MODULE_MAGIC macro.")));
}
/* OK to link it into list */
diff --git a/src/include/fmgr.h b/src/include/fmgr.h
index a0749a5fa6b..5b904cbad42 100644
--- a/src/include/fmgr.h
+++ b/src/include/fmgr.h
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/fmgr.h,v 1.44 2006/05/30 21:21:30 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/fmgr.h,v 1.45 2006/05/31 20:58:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -314,14 +314,14 @@ extern int no_such_variable
/*-------------------------------------------------------------------------
* Support for verifying backend compatibility of loaded modules
*
- * If a loaded module includes the macro call
+ * We require dynamically-loaded modules to include the macro call
* PG_MODULE_MAGIC;
- * (put this in only one source file), then we can check for obvious
- * incompatibility, such as being compiled for a different major PostgreSQL
- * version.
+ * so that we can check for obvious incompatibility, such as being compiled
+ * for a different major PostgreSQL version.
*
* To compile with versions of PostgreSQL that do not support this,
- * you may put an #ifdef/#endif test around it.
+ * you may put an #ifdef/#endif test around it. Note that in a multiple-
+ * source-file module, the macro call should only appear once.
*
* The specific items included in the magic block are intended to be ones that
* are custom-configurable and especially likely to break dynamically loaded
diff --git a/src/tutorial/funcs.c b/src/tutorial/funcs.c
index 0ca31ac19c9..2ac798f81b6 100644
--- a/src/tutorial/funcs.c
+++ b/src/tutorial/funcs.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/tutorial/funcs.c,v 1.14 2006/03/11 04:38:42 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/tutorial/funcs.c,v 1.15 2006/05/31 20:58:09 tgl Exp $ */
/******************************************************************************
These are user-defined functions that can be bound to a Postgres backend
@@ -16,6 +16,8 @@
#include "executor/executor.h" /* for GetAttributeByName() */
#include "utils/geo_decls.h" /* for point type */
+PG_MODULE_MAGIC;
+
/* These prototypes just prevent possible warnings from gcc. */