继续分析:

    setup_privileges();

展开:

这是设置权限。

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

其命令是:UPDATE pg_class   SET relacl = E'{"=r/\\"$POSTGRES_SUPERUSERNAME\\""}'   WHERE relkind IN ('r', 'v', 'S') AND relacl IS NULL;

/*
* Set up privileges
*
* We mark most system catalogs as world-readable. We don't currently have
* to touch functions, languages, or databases, because their default
* permissions are OK.
*
* Some objects may require different permissions by default, so we
* make sure we don't overwrite privilege sets that have already been
* set (NOT NULL).
*/
static void
setup_privileges(void)
{
PG_CMD_DECL;
char **line;
char **priv_lines;
static char *privileges_setup[] = {
"UPDATE pg_class "
" SET relacl = E'{\"=r/\\\\\"$POSTGRES_SUPERUSERNAME\\\\\"\"}' "
" WHERE relkind IN ('r', 'v', 'S') AND relacl IS NULL;\n",
"GRANT USAGE ON SCHEMA pg_catalog TO PUBLIC;\n",
"GRANT CREATE, USAGE ON SCHEMA public TO PUBLIC;\n",
"REVOKE ALL ON pg_largeobject FROM PUBLIC;\n",
NULL
}; fputs(_("setting privileges on built-in objects ... "), stdout);
fflush(stdout); snprintf(cmd, sizeof(cmd),
"\"%s\" %s template1 >%s",
backend_exec, backend_options,
DEVNULL);
PG_CMD_OPEN; priv_lines = replace_token(privileges_setup,
"$POSTGRES_SUPERUSERNAME", username);
for (line = priv_lines; *line != NULL; line++)
PG_CMD_PUTS(*line); PG_CMD_CLOSE; check_ok();
}

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

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

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

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

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

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

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

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

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

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

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

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

    继续分析: setup_schema(); 展开: 实质就是创建info_schema. cmd 是: "/home/pgsql/project/bin/postgres" --s ...

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

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

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

    继续分析: if (pwprompt || pwfilename) get_set_pwd(); 由于我启动initdb的时候,没有设置口令相关的选项,故此略过. 接下来: setup_depend( ...

  9. PostgreSQL的 initdb 源代码分析之十九

    继续分析: setup_dictionary(); 展开: 其中: cmd 是:"/home/pgsql/project/bin/postgres" --single -F -O ...

随机推荐

  1. Java [Leetcode 202]Happy Number

    题目描述: Write an algorithm to determine if a number is "happy". A happy number is a number d ...

  2. 开发ffmpeg/live555常见问题错误及解决方法

    #include <iostream>using namespace std;extern "C" {#include <libavcodec/avcodec.h ...

  3. windows 下FFMPEG的编译方法 附2012-9-19发布的FFMPEG编译好的SDK下载

    经过一晚上加一上午的奋斗,终于成功编译出了最新版的FFMPEG,下面是我编译的心得,因为是最新的,应该会对大家有用,编译的FFMPEG的版本是0.11.2,2012-09-19新发布的版本 平台:WI ...

  4. vc/mfc获取rgb图像数据后动态显示及保存图片的方法

    vc/mfc获取rgb图像数据后动态显示及保存图片的方法 该情况可用于视频通信中获取的位图数据回放显示或显示摄像头捕获的本地图像 第一种方法 #include<vfw.h> 加载 vfw3 ...

  5. linux笔试

    在对linux基本知识的归纳总结之后,这里是一份linux的测试题.希望能帮助大家复习和熟悉linux知识. 一.选择题 1.cron 后台常驻程序 (daemon) 用于:  A. 负责文件在网络中 ...

  6. 【再见RMQ】NYOJ-119-士兵杀敌(三),区间内大小差值

    [题目链接:NYOJ-119] 思路:转自 点我 ,讲的挺好. #include <cstdio> #include <math.h> #define max(a,b) ((a ...

  7. 【转】iOS自动布局进阶用法

    原文网址:http://www.cnblogs.com/dsxniubility/p/4266581.html 本文主要介绍几个我遇到并总结的相对高级的用法(当然啦牛人会觉得这也不算什么). 简单的s ...

  8. POJ 2481 Cows

    Cows Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 16546   Accepted: 5531 Description ...

  9. 【LeetCode 207】Course Schedule

    There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prer ...

  10. 【windows核心编程】DLL相关(1)

    DLL相关的东西 1.DLL的加载方式 隐式: #pragma comment(lib, "XX.lib"); 编译器去查找名为XX.dll的DLL,除了名字相同,该DLL和该LI ...