zoukankan      html  css  js  c++  java
  • PostgreSQL的 initdb 源代码分析之十四

    继续分析:

        /*
         * Make the per-database PG_VERSION for template1 only after init'ing it
         */
        write_version_file("base/1");

    就是在base/1目录下,生成一个  PG_VERSION 文件。

    [pgsql@localhost 1]$ pwd
    /home/pgsql/DemoDir/base/1
    [pgsql@localhost 1]$ cat PG_VERSION
    9.1
    [pgsql@localhost 1]$ 

    接下来:

        /* Create the stuff we don't need to use bootstrap mode for */
    
        setup_auth();

    展开后看:

    /*
     * set up the shadow password table
     */
    static void
    setup_auth(void)
    {
        PG_CMD_DECL;
        const char **line;
        static const char *pg_authid_setup[] = {
            /*
             * The authid table shouldn't be readable except through views, to
             * ensure passwords are not publicly visible.
             */
            "REVOKE ALL on pg_authid FROM public;
    ",
            NULL
        };
    
        fputs(_("initializing pg_authid ... "), stdout);
        fflush(stdout);
    
        snprintf(cmd, sizeof(cmd),
                 ""%s" %s template1 >%s",
                 backend_exec, backend_options,
                 DEVNULL);
        
        PG_CMD_OPEN;
    
        for (line = pg_authid_setup; *line != NULL; line++)
            PG_CMD_PUTS(*line);
    
        PG_CMD_CLOSE;
    
        check_ok();
    }

    此时,得到的cmd 是:

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

    然后再把  pg_authid_setup[] 里的内容送到 postgres里去执行。此处是 ”REVOKE ALL on pg_authid FROM public;”

  • 相关阅读:
    SSH整合简述一
    错误:找不到类org.springframework.web.context.ContextLoaderListener
    Spring(七)持久层
    CSS 类选择器(四)
    BeanFactory not initialized or already closed
    Spring(六)AOP切入方式
    Postman Mock Server
    Sentry快速开始并集成钉钉群机器人
    OAuth2实现单点登录SSO
    图解TCP三次握手
  • 原文地址:https://www.cnblogs.com/gaojian/p/3178272.html
Copyright © 2011-2022 走看看