@ -159,6 +159,7 @@ static char *conf_file;
static char * dictionary_file ;
static char * dictionary_file ;
static char * info_schema_file ;
static char * info_schema_file ;
static char * features_file ;
static char * features_file ;
static char * system_constraints_file ;
static char * system_views_file ;
static char * system_views_file ;
static bool success = false ;
static bool success = false ;
static bool made_new_pgdata = false ;
static bool made_new_pgdata = false ;
@ -251,10 +252,9 @@ static void bootstrap_template1(void);
static void setup_auth ( FILE * cmdfd ) ;
static void setup_auth ( FILE * cmdfd ) ;
static void get_su_pwd ( void ) ;
static void get_su_pwd ( void ) ;
static void setup_depend ( FILE * cmdfd ) ;
static void setup_depend ( FILE * cmdfd ) ;
static void setup_sysviews ( FILE * cmdfd ) ;
static void setup_run_file ( FILE * cmdfd , const char * filename ) ;
static void setup_description ( FILE * cmdfd ) ;
static void setup_description ( FILE * cmdfd ) ;
static void setup_collation ( FILE * cmdfd ) ;
static void setup_collation ( FILE * cmdfd ) ;
static void setup_dictionary ( FILE * cmdfd ) ;
static void setup_privileges ( FILE * cmdfd ) ;
static void setup_privileges ( FILE * cmdfd ) ;
static void set_info_version ( void ) ;
static void set_info_version ( void ) ;
static void setup_schema ( FILE * cmdfd ) ;
static void setup_schema ( FILE * cmdfd ) ;
@ -1600,17 +1600,16 @@ setup_depend(FILE *cmdfd)
}
}
/*
/*
* set up system views
* Run external file
*/
*/
static void
static void
setup_sysviews ( FILE * cmdfd )
setup_run_file ( FILE * cmdfd , const char * filename )
{
{
char * * line ;
char * * lines ;
char * * sysviews_setup ;
sysviews_setup = readfile ( system_views_ file) ;
lines = readfile ( filenam e ) ;
for ( line = sysviews_setup ; * line ! = NULL ; line + + )
for ( char * * line = lines ; * line ! = NULL ; line + + )
{
{
PG_CMD_PUTS ( * line ) ;
PG_CMD_PUTS ( * line ) ;
free ( * line ) ;
free ( * line ) ;
@ -1618,7 +1617,7 @@ setup_sysviews(FILE *cmdfd)
PG_CMD_PUTS ( " \n \n " ) ;
PG_CMD_PUTS ( " \n \n " ) ;
free ( sysviews_setup ) ;
free ( lines ) ;
}
}
/*
/*
@ -1661,27 +1660,6 @@ setup_collation(FILE *cmdfd)
PG_CMD_PUTS ( " SELECT pg_import_system_collations('pg_catalog'); \n \n " ) ;
PG_CMD_PUTS ( " SELECT pg_import_system_collations('pg_catalog'); \n \n " ) ;
}
}
/*
* load extra dictionaries ( Snowball stemmers )
*/
static void
setup_dictionary ( FILE * cmdfd )
{
char * * line ;
char * * conv_lines ;
conv_lines = readfile ( dictionary_file ) ;
for ( line = conv_lines ; * line ! = NULL ; line + + )
{
PG_CMD_PUTS ( * line ) ;
free ( * line ) ;
}
PG_CMD_PUTS ( " \n \n " ) ;
free ( conv_lines ) ;
}
/*
/*
* Set up privileges
* Set up privileges
*
*
@ -1882,20 +1860,7 @@ set_info_version(void)
static void
static void
setup_schema ( FILE * cmdfd )
setup_schema ( FILE * cmdfd )
{
{
char * * line ;
setup_run_file ( cmdfd , info_schema_file ) ;
char * * lines ;
lines = readfile ( info_schema_file ) ;
for ( line = lines ; * line ! = NULL ; line + + )
{
PG_CMD_PUTS ( * line ) ;
free ( * line ) ;
}
PG_CMD_PUTS ( " \n \n " ) ;
free ( lines ) ;
PG_CMD_PRINTF ( " UPDATE information_schema.sql_implementation_info "
PG_CMD_PRINTF ( " UPDATE information_schema.sql_implementation_info "
" SET character_value = '%s' "
" SET character_value = '%s' "
@ -2534,6 +2499,7 @@ setup_data_file_paths(void)
set_input ( & dictionary_file , " snowball_create.sql " ) ;
set_input ( & dictionary_file , " snowball_create.sql " ) ;
set_input ( & info_schema_file , " information_schema.sql " ) ;
set_input ( & info_schema_file , " information_schema.sql " ) ;
set_input ( & features_file , " sql_features.txt " ) ;
set_input ( & features_file , " sql_features.txt " ) ;
set_input ( & system_constraints_file , " system_constraints.sql " ) ;
set_input ( & system_views_file , " system_views.sql " ) ;
set_input ( & system_views_file , " system_views.sql " ) ;
if ( show_setting | | debug )
if ( show_setting | | debug )
@ -2895,6 +2861,8 @@ initialize_data_directory(void)
setup_auth ( cmdfd ) ;
setup_auth ( cmdfd ) ;
setup_run_file ( cmdfd , system_constraints_file ) ;
setup_depend ( cmdfd ) ;
setup_depend ( cmdfd ) ;
/*
/*
@ -2902,13 +2870,13 @@ initialize_data_directory(void)
* They are all droppable at the whim of the DBA .
* They are all droppable at the whim of the DBA .
*/
*/
setup_sysviews ( cmdfd ) ;
setup_run_file ( cmdfd , system_views_file ) ;
setup_description ( cmdfd ) ;
setup_description ( cmdfd ) ;
setup_collation ( cmdfd ) ;
setup_collation ( cmdfd ) ;
setup_dictionary ( cmdfd ) ;
setup_run_file ( cmdfd , dictionary_file ) ;
setup_privileges ( cmdfd ) ;
setup_privileges ( cmdfd ) ;