421 {
422
423 bool boot_postgis_enable_outdb_rasters = false;
424 MemoryContext old_context;
425
426
427
428
429
430 old_context = MemoryContextSwitchTo(TopMemoryContext);
431
432
433
434
435
441 }
442 else {
445 );
446 }
448 4,
449 "boot_postgis_gdal_enabled_drivers = %s",
451 );
452
453
454
455
456
460
461
462 if (env == NULL) {
463 elog(ERROR, "_PG_init: Cannot process environmental variable: POSTGIS_ENABLE_OUTDB_RASTERS");
464 return;
465 }
466
467 if (strcmp(env, "1") == 0)
468 boot_postgis_enable_outdb_rasters = true;
469
471 pfree(env);
472 }
474 4,
475 "boot_postgis_enable_outdb_rasters = %s",
476 boot_postgis_enable_outdb_rasters ? "TRUE" : "FALSE"
477 );
478
479
480 pg_install_lwgeom_handlers();
481
482
484
485
486 if ( postgis_guc_find_option("postgis.gdal_datapath") )
487 {
488
489
490
491 elog(WARNING, "'%s' is already set and cannot be changed until you reconnect", "postgis.gdal_datapath");
492 }
493 else
494 {
495 DefineCustomStringVariable(
496 "postgis.gdal_datapath",
497 "Path to GDAL data files.",
498 "Physical path to directory containing GDAL data files (sets the GDAL_DATA config option).",
500 NULL,
501 PGC_SUSET,
502 0,
503 NULL,
505 NULL
506 );
507 }
508
509 if ( postgis_guc_find_option("postgis.gdal_enabled_drivers") )
510 {
511
512
513
514 elog(WARNING, "'%s' is already set and cannot be changed until you reconnect", "postgis.gdal_enabled_drivers");
515 }
516 else
517 {
518 DefineCustomStringVariable(
519 "postgis.gdal_enabled_drivers",
520 "Enabled GDAL drivers.",
521 "List of enabled GDAL drivers by short name. To enable/disable all drivers, use 'ENABLE_ALL' or 'DISABLE_ALL' (sets the GDAL_SKIP config option).",
524 PGC_SUSET,
525 0,
526 NULL,
528 NULL
529 );
530 }
531
532 if ( postgis_guc_find_option("postgis.enable_outdb_rasters") )
533 {
534
535
536
537 elog(WARNING, "'%s' is already set and cannot be changed until you reconnect", "postgis.enable_outdb_rasters");
538 }
539 else
540 {
541 DefineCustomBoolVariable(
542 "postgis.enable_outdb_rasters",
543 "Enable Out-DB raster bands",
544 "If true, rasters can access data located outside the database",
546 boot_postgis_enable_outdb_rasters,
547 PGC_SUSET,
548 0,
549 NULL,
551 NULL
552 );
553 }
554
555
556 MemoryContextSwitchTo(old_context);
557}
void rt_set_handlers(rt_allocator allocator, rt_reallocator reallocator, rt_deallocator deallocator, rt_message_handler error_handler, rt_message_handler info_handler, rt_message_handler warning_handler)
This function is called when the PostgreSQL backend is taking care of the memory and we want to use p...
char * rtpg_trim(const char *input)
static void * rt_pg_alloc(size_t size)
static char * env_postgis_enable_outdb_rasters
static void rtpg_assignHookGDALDataPath(const char *newpath, void *extra)
static void rt_pg_error(const char *fmt, va_list ap) __attribute__((format(printf
bool enable_outdb_rasters
static void rt_pg_notice(const char *fmt, va_list ap) __attribute__((format(printf
static char * env_postgis_gdal_enabled_drivers
static char * boot_postgis_gdal_enabled_drivers
static void rtpg_assignHookGDALEnabledDrivers(const char *enabled_drivers, void *extra)
static void rt_pg_free(void *ptr)
char * gdal_enabled_drivers
static void rtpg_assignHookEnableOutDBRasters(bool enable, void *extra)
static void rt_pg_debug(const char *fmt, va_list ap) __attribute__((format(printf
static char * gdal_datapath
static void * rt_pg_realloc(void *mem, size_t size)
#define POSTGIS_RT_DEBUGF(level, msg,...)