继续分析:

    setup_schema();

展开:

实质就是创建info_schema。

cmd 是:

"/home/pgsql/project/bin/postgres" --single -F -O -c search_path=pg_catalog -c exit_on_error=true -j template1 >/dev/null

infor_schem_file是:/home/pgsql/project/share/information_schema.sql

/*
* load info schema and populate from features file
*/
static void
setup_schema(void)
{
PG_CMD_DECL;
char **line;
char **lines; fputs(_("creating information schema ... "), stdout);
fflush(stdout); lines = readfile(info_schema_file); ///fprintf(stderr,"\n====================info_schema_file is: %s\n", info_schema_file); /*
* We use -j here to avoid backslashing stuff in information_schema.sql
*/
snprintf(cmd, sizeof(cmd),
"\"%s\" %s -j template1 >%s",
backend_exec, backend_options,
DEVNULL); ///fprintf(stderr,"\n=====================cmd is: %s \n",cmd); PG_CMD_OPEN; for (line = lines; *line != NULL; line++)
{
PG_CMD_PUTS(*line);
free(*line);
} free(lines); PG_CMD_CLOSE; snprintf(cmd, sizeof(cmd),
"\"%s\" %s template1 >%s",
backend_exec, backend_options,
DEVNULL); PG_CMD_OPEN; PG_CMD_PRINTF1("UPDATE information_schema.sql_implementation_info "
" SET character_value = '%s' "
" WHERE implementation_info_name = 'DBMS VERSION';\n",
infoversion); PG_CMD_PRINTF1("COPY information_schema.sql_features "
" (feature_id, feature_name, sub_feature_id, "
" sub_feature_name, is_supported, comments) "
" FROM E'%s';\n",
escape_quotes(features_file)); PG_CMD_CLOSE; check_ok();
}

PostgreSQL的 initdb 源代码分析之二十一的更多相关文章

  1. PostgreSQL的 initdb 源代码分析之二

    继续分析 下面这一段,当 initdb --version 或者  initdb --help 才有意义. ) { ], || strcmp(argv[], ) { usage(progname); ...

  2. PostgreSQL的 initdb 源代码分析之二十四

    继续分析: make_template0(); 展开: 无需再作解释,就是创建template0数据库 /* * copy template1 to template0 */ static void ...

  3. PostgreSQL的 initdb 源代码分析之二十五

    继续分析: make_postgres(); 展开: 目的是创建postgres数据库. cmd是:/home/pgsql/project/bin/postgres" --single -F ...

  4. PostgreSQL的 initdb 源代码分析之二十三

    继续分析: vacuum_db(); 展开: cmd是:/home/pgsql/project/bin/postgres" --single -F -O -c search_path=pg_ ...

  5. PostgreSQL的 initdb 源代码分析之二十二

    继续分析 load_plpgsql(); 展开: 就是让postgres 执行 create extension plpgsql cmd是: "/home/pgsql/project/bin ...

  6. PostgreSQL的 initdb 源代码分析之二十

    继续分析: setup_privileges(); 展开: 这是设置权限. 其cmd是:"/home/pgsql/project/bin/postgres" --single -F ...

  7. PostgreSQL的 initdb 源代码分析之十二

    继续分析 /* Now create all the text config files */ setup_config(); 将其展开: 实质就是,确定各种参数,分别写入 postgresql.co ...

  8. PostgreSQL的 initdb 源代码分析之十一

    继续分析: /* Top level PG_VERSION is checked by bootstrapper, so make it first */ write_version_file(NUL ...

  9. PostgreSQL的initdb 源代码分析之六

    继续分析 下面的是获取运行此程序的用户名称,主要还是为了防止在linux下用root来运行的情形. effective_user = get_id(); ) username = effective_ ...

随机推荐

  1. Java [Leetcode 290]Word Pattern

    题目描述: Given a pattern and a string str, find if str follows the same pattern. Here follow means a fu ...

  2. 两个简单的python文件,实现删除本地文件夹和mongodb数据库的内容

    删除本地文件夹: import os , string , datetime ; str = '/home/niuguoqin/tmp/tomcat/'; b = (datetime.datetime ...

  3. ftp在shell脚本中的使用方法

    1. ftp自动登录批量下载文件. #####从ftp服务器上的/home/data 到 本地的/home/databackup#####!/bin/bashftp -n<<!open 1 ...

  4. memcached 最大连接数及其内存大小的设置

    memcached的基本设置: -p 监听的端口-l 连接的IP地址, 默认是本机-d start 启动memcached服务-d restart 重起memcached服务-d stop|shutd ...

  5. RegExp类型和text()方法

    ECMAScript通过RegExp类型来支持正则表达式 RegExp 实例方法:text() 它接受一个字符串参数,在模式与该参数匹配的情况下返回true,否则返回false,通常用在if语句中 / ...

  6. CodeSmith模板生成

    转:http://blog.csdn.net/jason_ldh/article/details/9887073 一.            工具设置 CodeSmith默认是不支持中文的,那么我们必 ...

  7. NiuTrans 日记 1

    这些天把东北大学自然语言实验室的NiuTrans 系统搭建并按照例子将短语系统运行了一遍,写这个日记主要是为了以后能提醒自己在这其中遇到的问题. 环境:短语系统我是windows和linux都运行了, ...

  8. Python多线程和Python的锁

    Python多线程 Python中实现多线程有两种方式,一种基于_thread模块(在Python2.x版本中为thread模块,没有下划线)的start_new_thread()函数,另一种基于th ...

  9. mybatis系列-13-resultMap总结

    resultType: 作用: 将查询结果按照sql列名pojo属性名一致性映射到pojo中. 场合: 常见一些明细记录的展示,比如用户购买商品明细,将关联查询信息全部展示在页面时,此时可直接使用re ...

  10. 使用PowerDesigner 设计SQL Server 数据库

    工具: Sybase PowerDesigner 12.5 Microsoft  SQL Server 2005 第一步:概念数据模型 打开PowerDesigner 软件,设计“概念数据模型”(Co ...