安装PostgreSQL 64 笔记
下载地址:
32位源代码
ftp://ftp.postgresql.org/pub/source/
64位官方下载
http://www.enterprisedb.com/downloads/postgres-postgresql-downloads
###################################
原创
2012-02-06 17:20:24
875阅读
继续分析 setup_description();展开后:就是要把share/postgres.description 文件的内容读入到 pg_description 和 pg_shdescription/* * load description data */static voidsetup_description(void){ PG_CMD_DECL; fputs(_("loading system objects' descriptions ... "), stdout); fflush(stdout); snprintf(cmd, sizeof(cmd),.
转载
2013-07-09 08:42:00
65阅读
2评论
继续分析: setup_collation()展开:/* * populate pg_collation */static voidsetup_collation(void){#if defined(HAVE_LOCALE_T) && !defined(WIN32) int i; FILE *locale_a_handle; char localebuf[NAMEDATALEN]; int count = 0; PG_CMD_DECL;#endif fputs(_("creating...
转载
2013-07-09 08:54:00
73阅读
2评论
继续分析: /* * 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_VERSION9.1[pgsql@localhost 1]$ 接下来: /* Create the stuff we d...
转载
2013-07-08 16:34:00
46阅读
2评论
继续分析由于 我并未进行特殊的参数设置,所以(strlen(default_text_search_config) == 0) 成立。故 调用 default_text_search_config = find_matching_ts_config(lc_ctype)最后输出:The default text search configuration will be set to "english". if (strlen(default_text_search_config) == 0) { default_text_search_config = find_mat...
转载
2013-07-07 16:56:00
67阅读
2评论
继续分析:由于我使用initdb的时候,没有指定 locale,所以会使用OS的缺省locale,这里是 en_US.UTF-8 printf(_("The files belonging to this database system will be owned " "by user \"%s\".\n" "This user must also own the server process.\n\n"), effective_user); if (strcmp(lc_ctype, lc_collate) ==
转载
2013-07-07 15:33:00
51阅读
2评论
继续其实接前面,整个while循环是这样的: while ((c = getopt_long(argc, argv, "dD:E:L:nU:WA:sT:X:", long_options, &option_index)) != -1) { switch (c) { ...... } ...... }这一句,c = getopt_long(argc, argv, "dD:E:L:nU:WA:sT:X:", lo...
转载
2013-07-05 16:33:00
41阅读
2评论
开始第一段:intmain(int argc, char *argv[]){/* * options with no short version return a low integer, the rest return * their short version value */ static struct option long_options[] = { {"pgdata", required_argument, NULL, 'D'}, {"encoding", required_argument, NULL, 'E'
转载
2013-07-05 15:32:00
41阅读
2评论
继续分析: 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 voidsetup_conversion(void){ PG_CMD_DECL
转载
2013-07-09 09:19:00
32阅读
2评论
继续分析: setup_privileges();展开:这是设置权限。其cmd是:"/home/pgsql/project/bin/postgres" --single -F -O -c search_path=pg_catalog -c exit_on_error=true template1 >/dev/null其命令是:UPDATE pg_class SET relacl = E'{"=r/\\"$POSTGRES_SUPERUSERNAME\\""}' WHERE relkind IN ('r
转载
2013-07-09 09:58:00
41阅读
2评论
继续:下面的是定义信号处理函数。 /* * now we are starting to do real work, trap signals so we can clean up */ /* some of these are not valid on Windows */#ifdef SIGHUP pqsignal(SIGHUP, trapsig);#endif#ifdef SIGINT pqsignal(SIGINT, trapsig);#endif#ifdef SIGQUIT pqsignal(SIGQUIT, trapsig);#endi...
转载
2013-07-08 08:07:00
65阅读
2评论
继续分析: setup_dictionary();展开:其中:cmd 是:"/home/pgsql/project/bin/postgres" --single -F -O -c search_path=pg_catalog -c exit_on_error=true -j template1 >/dev/nulldictionary_file 是:/home/pgsql/project/share/snowball_create.sql/* * load extra dictionaries (Snowball stemmers) */static voidsetu
转载
2013-07-09 09:36:00
57阅读
2评论
继续分析: if (pwprompt || pwfilename) get_set_pwd();由于我启动initdb的时候,没有设置口令相关的选项,故此略过。接下来: setup_depend();展开:就是一组sql问,送给 postgres 执行:cmd的值是:"/home/pgsql/project/bin/postgres" --single -F -O -c search_path=pg_catalog -c exit_on_error=true template1 >/dev/null/* * set up pg_depend */static void
转载
2013-07-08 17:01:00
58阅读
2评论
继续分析: /* Bootstrap template1 */ bootstrap_template1();展开:我这里读入的文件是:/home/pgsql/project/share/postgres.bki/* * run the BKI script in bootstrap mode to create template1 */static voidbootstrap_template1(void){ PG_CMD_DECL; char **line; char *talkargs = ""; char **bki_l...
转载
2013-07-08 15:44:00
116阅读
2评论
继续分析: /* Top level PG_VERSION is checked by bootstrapper, so make it first */ write_version_file(NULL);就是建立了一个 PG_VERSION的文件在我系统里,可以看到:[pgsql@localhost DemoDir]$ cat PG_VERSION9.1[pgsql@localhost DemoDir]$ 接下来:我先看看 set_null_conf 函数 /* Select suitable configuration settings */ set_null_co...
转载
2013-07-08 13:29:00
288阅读
2评论
继续分析 /* Now create all the text config files */ setup_config();将其展开:实质就是,确定各种参数,分别写入 postgresql.conf 、pg_hba.conf、pg_indent.conf 文件。/* * set up all the config files */static voidsetup_config(void){ char **conflines; char repltok[100]; char path[MAXPGPATH]; fputs(...
转载
2013-07-08 13:45:00
59阅读
2评论
继续分析,如下这段,因为条件不成立,被跳过: /* Create transaction log symlink, if required */ if (strcmp(xlog_dir, "") != 0) { fprintf(stderr,"In main function -----------------190\n"); char *linkloc; /* clean up xlog directory name, check it's absolute */ canonicalize_path(xlo...
转载
2013-07-08 09:16:00
66阅读
2评论
继续分析: if (pwprompt && pwfilename) { fprintf(stderr, _("%s: password prompt and password file cannot be specified together\n"), progname); exit(1); } if (authmethod == NULL || !strlen(authmethod)) { authwarning = _("\nWARNING: enabling \"trust\" authentication for ...
转载
2013-07-05 16:55:00
72阅读
2评论
接前面,继续分析: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 ma
转载
2013-07-05 17:07:00
59阅读
2评论
继续分析下面的是获取运行此程序的用户名称,主要还是为了防止在linux下用root来运行的情形。 effective_user = get_id(); if (strlen(username) == 0) username = effective_user;接下来,是准备好一写预备生成的文件的名称变量: set_input(&bki_file, "postgres.bki"); set_input(&desc_file, "postgres.description"); set_input(&shdesc_file, "
转载
2013-07-05 17:33:00
67阅读
2评论