继续分析:

    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 94]Binary Tree Inorder Traversal

    题目描述: Given a binary tree, return the inorder traversal of its nodes' values. For example:Given bina ...

  2. [转载]ios入门篇 -hello Word(1)

    温馨提示:,如果您使用移动终端阅读本篇文章,请连接wifi的情况下阅读,里面有大量图片,以免造成您不必要的损失.   潜水博客园很多年,闲来无事,聊一下自己的经历,语文不好(如有什么错别字,请您在下评 ...

  3. WebService 出现因 URL 意外地以“/HelloWorld”结束,请求格式无法识别。

    要在webservice的web.config文件中的 <system.web> 节点下加入: <webServices>    <protocols>       ...

  4. Mysqlbackup 备份详解(mysql官方备份工具)

    A.1全库备份. 命令: mysqlbackup --defaults-file=/home/mysql-server/mysql3/my.cnf  --user=root --password=ro ...

  5. 门户网站架构Nginx+Apache+MySQL+PHP+Memcached+Squid

    服务器的大用户量的承载方案 一.前言二.编译安装三. 安装MySQL.memcache四. 安装Apache.PHP.eAccelerator.php-memcache五. 安装Squid六.后记 一 ...

  6. 给table中某一列的文字右对齐

    一般来说,没写过jquery的前端人员,肯定是定义一个class,给每一行的那列加上align_r{text-align:right}.这是很麻烦的. 所以用jquery来写,可以$("ta ...

  7. CodeSmith模板生成

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

  8. 未能加载文件或程序集“Oracle.DataAccess, Version=2.112.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342"

    转载自原文 未能加载文件或程序集"Oracle.DataAccess, Version=2.112.1.0,..." 若本机的Oracle版本是32位系统,则在调用Oracle数据 ...

  9. 1050 数的计数 c语言实现

    描述 给定一个正整数,求其各位之和. 输入 输入一行,为一个正整数(最多10,000位). 输出 输出各位之和. 样例输入 17 样例输出 8 解析:这题主要是大数计算的问题,因为10000位的数无法 ...

  10. 使用SQL语句清空数据库所有表的数据

    使用SQL语句清空数据库所有表的数据 近来发现数据库过大,空间不足,因此打算将数据库的数据进行全面的清理,但表非常多,一张一张的清空,实在麻烦,因此就想利用SQL语句一次清空所有数据.找到了三种方法进 ...