PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwgeom_init_backend()

void lwgeom_init_backend ( void  )

Definition at line 116 of file lwgeom_backend_api.c.

117 {
118  /* #2382 Before trying to create a user GUC, make sure */
119  /* that the name is not already in use. Why would it be in use? */
120  /* During an upgrade, a prior copy of the PostGIS library will */
121  /* already be loaded in memory and the GUC already defined. We */
122  /* can skip GUC definition in this case, so we just return. */
123  static const char *guc_name = "postgis.backend";
124  // const char *guc_installed = GetConfigOption(guc_name, TRUE, FALSE);
125 
126  /* Uh oh, this GUC name already exists. Ordinarily we could just go on */
127  /* our way, but the way the postgis.backend works is by using the "assign" */
128  /* callback to change which backend is in use by flipping a global variable */
129  /* over. This saves the overhead of looking up the engine every time, at */
130  /* the expense of the extra complexity. */
131  if ( postgis_guc_find_option(guc_name) )
132  {
133  /* In this narrow case the previously installed GUC is tied to the callback in */
134  /* the previously loaded library. Probably this is happening during an */
135  /* upgrade, so the old library is where the callback ties to. */
136  elog(WARNING, "'%s' is already set and cannot be changed until you reconnect", guc_name);
137  return;
138  }
139 
140  /* Good, the GUC name is not already in use, so this must be a fresh */
141  /* and clean new load of the library, and we can define the user GUC */
142  DefineCustomStringVariable( guc_name, /* name */
143  "Sets the PostGIS Geometry Backend.", /* short_desc */
144  "Sets the PostGIS Geometry Backend (allowed values are 'geos' or 'sfcgal')", /* long_desc */
145  &lwgeom_backend_name, /* valueAddr */
146  (char *)lwgeom_backends[0].name, /* bootValue */
147  PGC_USERSET, /* GucContext context */
148  0, /* int flags */
149  NULL, /* GucStringCheckHook check_hook */
150  lwgeom_backend_switch, /* GucStringAssignHook assign_hook */
151  NULL /* GucShowHook show_hook */
152  );
153 }
struct lwgeom_backend_definition lwgeom_backends[LWGEOM_NUM_BACKENDS]
char * lwgeom_backend_name
static void lwgeom_backend_switch(const char *newvalue, __attribute__((__unused__)) void *extra)

References lwgeom_backend_name, lwgeom_backend_switch(), lwgeom_backends, and lwgeom_backend_definition::name.

Referenced by _PG_init().

Here is the call graph for this function:
Here is the caller graph for this function: