博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
PostgreSQL的 initdb 源代码分析之二十五
阅读量:7096 次
发布时间:2019-06-28

本文共 1682 字,大约阅读时间需要 5 分钟。

继续分析:

make_postgres();

 展开:

目的是创建postgres数据库。

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

/* * copy template1 to postgres */static voidmake_postgres(void){    PG_CMD_DECL;    const char **line;    static const char *postgres_setup[] = {        "CREATE DATABASE postgres;\n",        "COMMENT ON DATABASE postgres IS 'default administrative connection database';\n",        NULL    };    fputs(_("copying template1 to postgres ... "), stdout);    fflush(stdout);    snprintf(cmd, sizeof(cmd),             "\"%s\" %s template1 >%s",             backend_exec, backend_options,             DEVNULL);    PG_CMD_OPEN;    for (line = postgres_setup; *line; line++)        PG_CMD_PUTS(*line);    PG_CMD_CLOSE;    check_ok();}

 再接下来,就是结束了:

if (authwarning != NULL)        fprintf(stderr, "%s", authwarning);    /* Get directory specification used to start this executable */    strcpy(bin_dir, argv[0]);    get_parent_directory(bin_dir);    printf(_("\nSuccess. You can now start the database server using:\n\n"             "    %s%s%spostgres%s -D %s%s%s\n"             "or\n"             "    %s%s%spg_ctl%s -D %s%s%s -l logfile start\n\n"),       QUOTE_PATH, bin_dir, (strlen(bin_dir) > 0) ? DIR_SEP : "", QUOTE_PATH,           QUOTE_PATH, pg_data_native, QUOTE_PATH,       QUOTE_PATH, bin_dir, (strlen(bin_dir) > 0) ? DIR_SEP : "", QUOTE_PATH,           QUOTE_PATH, pg_data_native, QUOTE_PATH);    return 0;

会给出一些提示信息,类似于:

Success. You can now start the database server using:    /home/pgsql/project/bin/postgres -D /home/pgsql/DemoDiror    /home/pgsql/project/bin/pg_ctl -D /home/pgsql/DemoDir -l logfile start
 
 
 
 
 
 
 

转载地址:http://hwoql.baihongyu.com/

你可能感兴趣的文章
DualPivotQuicksort
查看>>
linux Centos 6.5 安装桌面环境GNOME
查看>>
Redux DevTools 工具 (redux-devtools是一个有趣而又高效的redux开发工具)
查看>>
Android 自定义ViewGroup 实战篇 -> 实现FlowLayout
查看>>
禁止百度流氓安装
查看>>
17款最佳的代码审查工具
查看>>
mysql_5.7.17 安装时无法启动,尝试很多方法最后一招搞定!!!
查看>>
Nginx 配置多站点
查看>>
Object-C代码练习【代码块】
查看>>
Swift项目兼容Objective-C问题汇总
查看>>
安装apache2.4+php5.6 记录
查看>>
Elasticsearch 2.3.3 安装
查看>>
关于Concurrent的几个概念
查看>>
.Net 大型分布式基础服务架构横向演变概述
查看>>
mybaits 动态SQL语句
查看>>
20个非常有用的Java程序片段
查看>>
100-56
查看>>
个人笔记区分Uri和Url的使用区别
查看>>
CCNA实验
查看>>
[收集帖]MySQL修改root密码的多种方法
查看>>