PostgreSQL的 initdb 源代码分析之十八

继续分析:

    setup_conversion();

展开:

其实质是:

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

传递参数:/home/pgsql/project/share/conversion_create.sql

/*
 * load conversion functions
 */
static void
setup_conversion(void)
{
    PG_CMD_DECL;
    char      **line;
    char      **conv_lines;

    fputs(_("creating conversions ... "), stdout);
    fflush(stdout);

    snprintf(cmd, sizeof(cmd),
             "\"%s\" %s template1 >%s",
             backend_exec, backend_options,
             DEVNULL);

    PG_CMD_OPEN;

    conv_lines = readfile(conversion_file);
    for (line = conv_lines; *line != NULL; line++)
    {
        if (strstr(*line, "DROP CONVERSION") != *line)
            PG_CMD_PUTS(*line);
        free(*line);
    }

    free(conv_lines);

    PG_CMD_CLOSE;

    check_ok();
}

 

posted @ 2013-07-09 09:19  健哥的数据花园  阅读(340)  评论(0编辑  收藏  举报