PostgreSQL的 initdb 源代码分析之十六
继续分析
setup_description();
展开后:
就是要把 share/postgres.description 文件的内容读入到 pg_description 和 pg_shdescription
/*
* load description data
*/
static void
setup_description(void)
{
PG_CMD_DECL; fputs(_("loading system objects' descriptions ... "), stdout);
fflush(stdout); snprintf(cmd, sizeof(cmd),
"\"%s\" %s template1 >%s",
backend_exec, backend_options,
DEVNULL); PG_CMD_OPEN; PG_CMD_PUTS("CREATE TEMP TABLE tmp_pg_description ( "
" objoid oid, "
" classname name, "
" objsubid int4, "
" description text) WITHOUT OIDS;\n"); PG_CMD_PRINTF1("COPY tmp_pg_description FROM E'%s';\n",
escape_quotes(desc_file)); PG_CMD_PUTS("INSERT INTO pg_description "
" SELECT t.objoid, c.oid, t.objsubid, t.description "
" FROM tmp_pg_description t, pg_class c "
" WHERE c.relname = t.classname;\n"); PG_CMD_PUTS("CREATE TEMP TABLE tmp_pg_shdescription ( "
" objoid oid, "
" classname name, "
" description text) WITHOUT OIDS;\n"); PG_CMD_PRINTF1("COPY tmp_pg_shdescription FROM E'%s';\n",
escape_quotes(shdesc_file)); PG_CMD_PUTS("INSERT INTO pg_shdescription "
" SELECT t.objoid, c.oid, t.description "
" FROM tmp_pg_shdescription t, pg_class c "
" WHERE c.relname = t.classname;\n"); /* Create default descriptions for operator implementation functions */
PG_CMD_PUTS("WITH funcdescs AS ( "
"SELECT p.oid as p_oid, oprname, "
"coalesce(obj_description(o.oid, 'pg_operator'),'') as opdesc "
"FROM pg_proc p JOIN pg_operator o ON oprcode = p.oid ) "
"INSERT INTO pg_description "
" SELECT p_oid, 'pg_proc'::regclass, 0, "
" 'implementation of ' || oprname || ' operator' "
" FROM funcdescs "
" WHERE opdesc NOT LIKE 'deprecated%' AND "
" NOT EXISTS (SELECT 1 FROM pg_description "
" WHERE objoid = p_oid AND classoid = 'pg_proc'::regclass);\n"); PG_CMD_CLOSE; check_ok();
}
PostgreSQL的 initdb 源代码分析之十六的更多相关文章
- PostgreSQL的 initdb 源代码分析之十五
继续分析: if (pwprompt || pwfilename) get_set_pwd(); 由于我启动initdb的时候,没有设置口令相关的选项,故此略过. 接下来: setup_depend( ...
- PostgreSQL的 initdb 源代码分析之十二
继续分析 /* Now create all the text config files */ setup_config(); 将其展开: 实质就是,确定各种参数,分别写入 postgresql.co ...
- PostgreSQL的 initdb 源代码分析之十九
继续分析: setup_dictionary(); 展开: 其中: cmd 是:"/home/pgsql/project/bin/postgres" --single -F -O ...
- PostgreSQL的 initdb 源代码分析之十八
继续分析: setup_conversion(); 展开: 其实质是: 运行命令:"/home/pgsql/project/bin/postgres" --single -F -O ...
- PostgreSQL的 initdb 源代码分析之十四
继续分析: /* * Make the per-database PG_VERSION for template1 only after init'ing it */ write_version_fi ...
- PostgreSQL的 initdb 源代码分析之十
继续分析, 如下这段,因为条件不成立,被跳过: /* Create transaction log symlink, if required */ ) { fprintf(stderr,"I ...
- PostgreSQL的 initdb 源代码分析之二十四
继续分析: make_template0(); 展开: 无需再作解释,就是创建template0数据库 /* * copy template1 to template0 */ static void ...
- PostgreSQL的 initdb 源代码分析之二十五
继续分析: make_postgres(); 展开: 目的是创建postgres数据库. cmd是:/home/pgsql/project/bin/postgres" --single -F ...
- PostgreSQL的 initdb 源代码分析之二十二
继续分析 load_plpgsql(); 展开: 就是让postgres 执行 create extension plpgsql cmd是: "/home/pgsql/project/bin ...
随机推荐
- 学习:java设计模式—工厂模式
一.工厂模式主要是为创建对象提供过渡接口,以便将创建对象的具体过程屏蔽隔离起来,达到提高灵活性的目的. 工厂模式在<Java与模式>中分为三类: 1)简单工厂模式(Simple Facto ...
- Spring学习之AOP
Spring-AOP(Aspect-orented programming) 在业务流程中插入与业务无关的逻辑,这样的逻辑称为Cross-cutting concerns,将Crossing-cutt ...
- 【转】VI/VIM常用命令
原文网址:http://www.blogjava.net/woxingwosu/archive/2007/09/06/125193.html Vi是“Visual interface”的简称,它在Li ...
- 用命令行(CMD)中启动和关闭ORACLE服务
lsnrctl start开启监听 lsnrctl stop停止监听 net start oracleserviceoracle开启oracle服务 net stop oracleserviceora ...
- Linux下的sniffer工具--TcpDump的安装和使用
在如今众多的黑客技术中,嗅探器(sniffer)是最常见,也是最重要的技术之一. 用过windows平台上的sniffer工具(例如,netxray和sniffer pro软件)的朋友可能都知道,在共 ...
- UVA 10047 The Monocycle
大白图论第二题··· 题意:独轮车的轮子被均分成五块,每块一个颜色,每走过一个格子恰好转过一个颜色. 在一个迷宫中,只能向前走或者左转90度或右转90度(我曾天真的认为是向左走和向右走···),每个操 ...
- RecordWriter接口解析
RecordWriter是将Map/Reduce结果(Key-Value)输出到文件系统中. /** * <code>RecordWriter</code> writes th ...
- Android Dialog用法
摘要: 创建对话框 一个对话框一般是一个出现在当前Activity之上的一个小窗口. 处于下面的Activity失去焦点, 对话框接受所有的用户交互. 对话框一般用于提示信息和与当前应用程序直接相关的 ...
- UITableView 点击展开的实现
推介看下这里的 内容 http://www.cnblogs.com/kenshincui/p/3931948.html IOS8 above UITabliViewCell 利用 autolayou ...
- WiFi Test Entity
项目要结了,总结下每次新版本WiFi需要测试的内容 1 IOT1.1 connect target[Connected]; modify wifi pwd to wrong pwd[Au ...