PostgreSQL的 initdb 源代码分析之二十四
继续分析:
make_template0();
展开:
无需再作解释,就是创建template0数据库
/*
* copy template1 to template0
*/
static void
make_template0(void)
{
PG_CMD_DECL;
const char **line;
static const char *template0_setup[] = {
"CREATE DATABASE template0;\n",
"UPDATE pg_database SET "
" datistemplate = 't', "
" datallowconn = 'f' "
" WHERE datname = 'template0';\n", /*
* We use the OID of template0 to determine lastsysoid
*/
"UPDATE pg_database SET datlastsysoid = "
" (SELECT oid FROM pg_database "
" WHERE datname = 'template0');\n", /*
* Explicitly revoke public create-schema and create-temp-table
* privileges in template1 and template0; else the latter would be on
* by default
*/
"REVOKE CREATE,TEMPORARY ON DATABASE template1 FROM public;\n",
"REVOKE CREATE,TEMPORARY ON DATABASE template0 FROM public;\n", "COMMENT ON DATABASE template0 IS 'unmodifiable empty database';\n", /*
* Finally vacuum to clean up dead rows in pg_database
*/
"VACUUM FULL pg_database;\n",
NULL
}; fputs(_("copying template1 to template0 ... "), stdout);
fflush(stdout); snprintf(cmd, sizeof(cmd),
"\"%s\" %s template1 >%s",
backend_exec, backend_options,
DEVNULL); PG_CMD_OPEN; for (line = template0_setup; *line; line++)
PG_CMD_PUTS(*line); PG_CMD_CLOSE; check_ok();
}
由此而知,在initdb工作的时候,是先创建的template1数据库,再创建template01数据库。
PostgreSQL的 initdb 源代码分析之二十四的更多相关文章
- 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 ...
- PostgreSQL的 initdb 源代码分析之二十
继续分析: setup_privileges(); 展开: 这是设置权限. 其cmd是:"/home/pgsql/project/bin/postgres" --single -F ...
- PostgreSQL的 initdb 源代码分析之二
继续分析 下面这一段,当 initdb --version 或者 initdb --help 才有意义. ) { ], || strcmp(argv[], ) { usage(progname); ...
- PostgreSQL的 initdb 源代码分析之二十三
继续分析: vacuum_db(); 展开: cmd是:/home/pgsql/project/bin/postgres" --single -F -O -c search_path=pg_ ...
- PostgreSQL的 initdb 源代码分析之二十一
继续分析: setup_schema(); 展开: 实质就是创建info_schema. cmd 是: "/home/pgsql/project/bin/postgres" --s ...
- Redis源代码分析(二十四)--- tool工具类(2)
在上篇文章中初步的分析了一下,Redis工具类文件里的一些使用方法,包含2个随机算法和循环冗余校验算法,今天,继续学习Redis中的其它的一些辅助工具类的使用方法.包含里面的大小端转换算法,sha算法 ...
- PostgreSQL的 initdb 源代码分析之十二
继续分析 /* Now create all the text config files */ setup_config(); 将其展开: 实质就是,确定各种参数,分别写入 postgresql.co ...
- PostgreSQL的 initdb 源代码分析之十五
继续分析: if (pwprompt || pwfilename) get_set_pwd(); 由于我启动initdb的时候,没有设置口令相关的选项,故此略过. 接下来: setup_depend( ...
随机推荐
- dict 字典
Python 学习笔记[dict的操作方法] Python中dict详解
- 载入在线jQuery库
以百度库为例 <script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script&g ...
- windows下MySql没有setup.exe时的安装方法
01.把 mysql-advanced-5.6.17-winx64.zip 解压到自定义 D:\mysql-5.6.17-W64 或 D:\mysql-advanced-5.6.17-winx64 目 ...
- 【转】IOS 计时器 NSTimer
原文网址:http://blog.csdn.net/tangshoulin/article/details/7644124 1.初始化 + (NSTimer *)timerWithTimeInterv ...
- 【原创】利用Windows系统日志统计员工每天上下班考勤时间
利用Windows系统日志统计员工每天上下班考勤时间(命令行参数为统计月份): using System; using System.Collections.Generic; using System ...
- [译]LINT TO SQL 介绍(数据库查询) - Part.3
出处:Linq To Sql (Part.3 – Querying our database) 术语表 Built-in:内置的 Clause:子句 Debugger:调试器 Object Relat ...
- android总结
针对Android有以下几点需要注意: 1.是不是应该把数据刷新操作放在onResume()中? @Override public void onResume() { ...
- 微软控制台带来的PHP控制台输出问题
/** * 测试文件包含方式对跨平台的影响 * 控制台下测试. * 默认的文件编码为 UTF-8 */ function testChinese() { $file = __DIR__ . '/con ...
- linux 下的进程管理工具 supervisor
在linux下监控进程: 1)yum install python-setuptools linux下的python安装工具 2)easy_install supervisor 安装sup ...
- SQL入门
# SQL入门 数据库表 一个数据库(database)通常包含一个或多个表(table). 每一个表都有一个名字标识. 表单包含数据的记录(行). 一些重要的SQL命令(常用的吧) 命令 说明 ...