PostGIS  2.2.7dev-r@@SVN_REVISION@@
void lwgeom_init_backend ( void  )

Definition at line 187 of file lwgeom_backend_api.c.

References guc_find_option(), lwgeom_backend_name, lwgeom_backend_switch(), and POSTGIS_PGSQL_VERSION.

Referenced by _PG_init().

188 {
189  /* #2382 Before trying to create a user GUC, make sure */
190  /* that the name is not already in use. Why would it be in use? */
191  /* During an upgrade, a prior copy of the PostGIS library will */
192  /* already be loaded in memory and the GUC already defined. We */
193  /* can skip GUC definition in this case, so we just return. */
194  static const char *guc_name = "postgis.backend";
195  // const char *guc_installed = GetConfigOption(guc_name, TRUE, FALSE);
196 
197  /* Uh oh, this GUC name already exists. Ordinarily we could just go on */
198  /* our way, but the way the postgis.backend works is by using the "assign" */
199  /* callback to change which backend is in use by flipping a global variable */
200  /* over. This saves the overhead of looking up the engine every time, at */
201  /* the expense of the extra complexity. */
202  if ( guc_find_option(guc_name) )
203  {
204  /* In this narrow case the previously installed GUC is tied to the callback in */
205  /* the previously loaded library. Probably this is happening during an */
206  /* upgrade, so the old library is where the callback ties to. */
207  elog(WARNING, "'%s' is already set and cannot be changed until you reconnect", guc_name);
208  return;
209  }
210 
211  /* Good, the GUC name is not already in use, so this must be a fresh */
212  /* and clean new load of the library, and we can define the user GUC */
213  DefineCustomStringVariable( guc_name, /* name */
214  "Sets the PostGIS Geometry Backend.", /* short_desc */
215  "Sets the PostGIS Geometry Backend (allowed values are 'geos' or 'sfcgal')", /* long_desc */
216  &lwgeom_backend_name, /* valueAddr */
217  (char *)lwgeom_backends[0].name, /* bootValue */
218  PGC_USERSET, /* GucContext context */
219  0, /* int flags */
220 #if POSTGIS_PGSQL_VERSION >= 91
221  NULL, /* GucStringCheckHook check_hook */
222 #endif
223  lwgeom_backend_switch, /* GucStringAssignHook assign_hook */
224  NULL /* GucShowHook show_hook */
225  );
226 }
static int guc_find_option(const char *name)
char * lwgeom_backend_name
#define POSTGIS_PGSQL_VERSION
Definition: sqldefines.h:9
static void lwgeom_backend_switch(const char *newvalue, void *extra)
struct lwgeom_backend_definition lwgeom_backends[LWGEOM_NUM_BACKENDS]

Here is the call graph for this function:

Here is the caller graph for this function: