651 {
652
653 bool boot_postgis_enable_outdb_rasters = false;
654 MemoryContext old_context;
655
656
657
658
659
660 old_context = MemoryContextSwitchTo(TopMemoryContext);
661
662
663
664
665
671 }
672 else {
675 );
676 }
678 4,
679 "boot_postgis_gdal_enabled_drivers = %s",
681 );
682
683
684
685
686
690
691
692 if (env == NULL) {
693 elog(ERROR, "_PG_init: Cannot process environmental variable: POSTGIS_ENABLE_OUTDB_RASTERS");
694 return;
695 }
696
697 if (strcmp(env, "1") == 0)
698 boot_postgis_enable_outdb_rasters = true;
699
701 pfree(env);
702 }
704 4,
705 "boot_postgis_enable_outdb_rasters = %s",
706 boot_postgis_enable_outdb_rasters ? "TRUE" : "FALSE"
707 );
708
709
710 pg_install_lwgeom_handlers();
711
712
716
717
718 if ( postgis_guc_find_option("postgis.gdal_datapath") )
719 {
720
721
722
723 elog(WARNING, "'%s' is already set and cannot be changed until you reconnect", "postgis.gdal_datapath");
724 }
725 else
726 {
727 DefineCustomStringVariable(
728 "postgis.gdal_datapath",
729 "Path to GDAL data files.",
730 "Physical path to directory containing GDAL data files (sets the GDAL_DATA config option).",
732 NULL,
733 PGC_SUSET,
734 0,
735 NULL,
737 NULL
738 );
739 }
740
741 if ( postgis_guc_find_option("postgis.gdal_enabled_drivers") )
742 {
743
744
745
746 elog(WARNING, "'%s' is already set and cannot be changed until you reconnect", "postgis.gdal_enabled_drivers");
747 }
748 else
749 {
750 DefineCustomStringVariable(
751 "postgis.gdal_enabled_drivers",
752 "Enabled GDAL drivers.",
753 "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).",
756 PGC_SUSET,
757 0,
758 NULL,
760 NULL
761 );
762 }
763
764 if ( postgis_guc_find_option("postgis.enable_outdb_rasters") )
765 {
766
767
768
769 elog(WARNING, "'%s' is already set and cannot be changed until you reconnect", "postgis.enable_outdb_rasters");
770 }
771 else
772 {
773 DefineCustomBoolVariable(
774 "postgis.enable_outdb_rasters",
775 "Enable Out-DB raster bands",
776 "If true, rasters can access data located outside the database",
778 boot_postgis_enable_outdb_rasters,
779 PGC_SUSET,
780 0,
781 NULL,
783 NULL
784 );
785 }
786
787
788 if ( postgis_guc_find_option("postgis.gdal_cpl_debug") )
789 {
790
791
792
793 elog(WARNING, "'%s' is already set and cannot be changed until you reconnect", "postgis.gdal_cpl_debug");
794 }
795 else
796 {
797 DefineCustomBoolVariable(
798 "postgis.gdal_cpl_debug",
799 "Enable GDAL debugging messages",
800 "GDAL debug messages will be sent at the PgSQL debug log level",
802 false,
803 PGC_SUSET,
804 0,
805 NULL,
807 NULL
808 );
809 }
810
811 if ( postgis_guc_find_option("postgis.gdal_vsi_options") )
812 {
813 elog(WARNING, "'%s' is already set and cannot be changed until you reconnect", "postgis.gdal_vsi_options");
814 }
815 else
816 {
817 DefineCustomStringVariable(
818 "postgis.gdal_vsi_options",
819 "VSI config options",
820 "Set the config options to be used when opening /vsi/ network files",
822 "",
823 PGC_USERSET,
824 0,
826 NULL,
827 NULL
828 );
829 }
830
831
832 MemoryContextSwitchTo(old_context);
833}
void rt_set_handlers_options(rt_allocator allocator, rt_reallocator reallocator, rt_deallocator deallocator, rt_message_handler error_handler, rt_message_handler info_handler, rt_message_handler warning_handler, rt_options options_handler)
void rtpg_gdal_set_cpl_debug(bool value, void *extra)
char * rtpg_trim(const char *input)
static void * rt_pg_alloc(size_t size)
static char * env_postgis_enable_outdb_rasters
static char * gdal_vsi_options
static void rtpg_assignHookGDALDataPath(const char *newpath, void *extra)
static void rt_pg_error(const char *fmt, va_list ap) __attribute__((format(printf
static bool enable_outdb_rasters
static void rt_pg_notice(const char *fmt, va_list ap) __attribute__((format(printf
static bool rt_pg_vsi_check_options(char **newval, void **extra, GucSource source)
static char * rt_pg_options(const char *varname)
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)
static bool gdal_cpl_debug
static 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,...)