日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

PostgreSQL的initdb 源代码分析之五

發布時間:2025/3/18 数据库 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 PostgreSQL的initdb 源代码分析之五 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

接前面,繼續分析:?putenv("TZ=GMT") 設置了時區信息。

find_other_exec(argv[0], "postgres", PG_BACKEND_VERSIONSTR, backend_exec))

就是要找到同目錄下、同版本的postgres備用。initdb 執行后期,很多事情要依賴 postgres來處理的。

/** Also ensure that TZ is set, so that we don't waste time identifying the* system timezone each of the many times we start a standalone backend.* It's okay to use a hard-wired value here because nothing done during* initdb cares about the timezone setting.*/putenv("TZ=GMT");if ((ret = find_other_exec(argv[0], "postgres", PG_BACKEND_VERSIONSTR,backend_exec)) < 0){char full_path[MAXPGPATH];if (find_my_exec(argv[0], full_path) < 0)strlcpy(full_path, progname, sizeof(full_path));if (ret == -1)fprintf(stderr,_("The program \"postgres\" is needed by %s ""but was not found in the\n""same directory as \"%s\".\n""Check your installation.\n"),progname, full_path);elsefprintf(stderr,_("The program \"postgres\" was found by \"%s\"\n""but was not the same version as %s.\n""Check your installation.\n"),full_path, progname);exit(1);}

接下來,獲得路徑:

一個是 bin_path: ? ? ?就是initdb執行的路徑。我運行的結果是: /home/pgsql/project/bin

一個是 share_path: ?就是一些共享用信息的路徑。我運行的結果是: /home/pgsql/project/share

/* store binary directory */strcpy(bin_path, backend_exec);*last_dir_separator(bin_path) = '\0';canonicalize_path(bin_path);fprintf(stderr,"bin_path is: %s \n",bin_path);if (!share_path){share_path = pg_malloc(MAXPGPATH);get_share_path(backend_exec, share_path);}else if (!is_absolute_path(share_path)){fprintf(stderr, _("%s: input file location must be an absolute path\n"), progname);exit(1);}canonicalize_path(share_path);fprintf(stderr,"share_path is: %s \n",share_path);





本文轉自健哥的數據花園博客園博客,原文鏈接:http://www.cnblogs.com/gaojian/p/3174020.html,如需轉載請自行聯系原作者

總結

以上是生活随笔為你收集整理的PostgreSQL的initdb 源代码分析之五的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。