PostgreSQL的 initdb 源代码分析之十六
继续分析setup_description();展开后:就是要把share/postgres.description 文件的内容读入到 pg_description 和 pg_shdescription/** load description data*/static voidsetup_description(void...
·
继续分析
setup_description();
展开后:
就是要把 share/postgres.description 文件的内容读入到 pg_description 和 pg_shdescription
/* * load description data */ static void setup_description(void) { PG_CMD_DECL; fputs(_("loading system objects' descriptions ... "), stdout); fflush(stdout); snprintf(cmd, sizeof(cmd), "\"%s\" %s template1 >%s", backend_exec, backend_options, DEVNULL); PG_CMD_OPEN; PG_CMD_PUTS("CREATE TEMP TABLE tmp_pg_description ( " " objoid oid, " " classname name, " " objsubid int4, " " description text) WITHOUT OIDS;\n"); PG_CMD_PRINTF1("COPY tmp_pg_description FROM E'%s';\n", escape_quotes(desc_file)); PG_CMD_PUTS("INSERT INTO pg_description " " SELECT t.objoid, c.oid, t.objsubid, t.description " " FROM tmp_pg_description t, pg_class c " " WHERE c.relname = t.classname;\n"); PG_CMD_PUTS("CREATE TEMP TABLE tmp_pg_shdescription ( " " objoid oid, " " classname name, " " description text) WITHOUT OIDS;\n"); PG_CMD_PRINTF1("COPY tmp_pg_shdescription FROM E'%s';\n", escape_quotes(shdesc_file)); PG_CMD_PUTS("INSERT INTO pg_shdescription " " SELECT t.objoid, c.oid, t.description " " FROM tmp_pg_shdescription t, pg_class c " " WHERE c.relname = t.classname;\n"); /* Create default descriptions for operator implementation functions */ PG_CMD_PUTS("WITH funcdescs AS ( " "SELECT p.oid as p_oid, oprname, " "coalesce(obj_description(o.oid, 'pg_operator'),'') as opdesc " "FROM pg_proc p JOIN pg_operator o ON oprcode = p.oid ) " "INSERT INTO pg_description " " SELECT p_oid, 'pg_proc'::regclass, 0, " " 'implementation of ' || oprname || ' operator' " " FROM funcdescs " " WHERE opdesc NOT LIKE 'deprecated%' AND " " NOT EXISTS (SELECT 1 FROM pg_description " " WHERE objoid = p_oid AND classoid = 'pg_proc'::regclass);\n"); PG_CMD_CLOSE; check_ok(); }
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
已为社区贡献22条内容
所有评论(0)