继续分析:

    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();
}

 

转载于:https://www.cnblogs.com/gaojian/p/3179198.html

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐