當前位置:編程學習大全網 - 網站源碼 - 如何修改Postgresql源碼新增壹張系統表

如何修改Postgresql源碼新增壹張系統表

1) 在catalog 的makefile 中添加相應的系統表頭文件

./src/backend/catalog/Makefile:42: pg_foreign_table.h pg_partition_key.h \

2) 建表 -- 以pg_partition_key為例:

2.1)在include的 catalog目錄下添加這張表的定義

#ifndef PG_PARTITION_KEY_H

#define PG_PARTITION_KEY_H

#include 'catalog/genbki.h'

#define PartitionKeyRelationId 3180

CATALOG(pg_partition_key,3180) BKI_WITHOUT_OIDS

{

Oid pkrelid;

int16 pkattnum;

} FormData_pg_partition_key;

typedef FormData_pg_partition_key *Form_pg_partition_key;

#define Natts_pg_partition_key ? 2

#define Anum_pg_partition_key_pkrelid ? 1

#define Anum_pg_partition_key_pkattnum 2

#endif

2.2) 在catalog 的indexing.h 頭文件中添加系統表的唯壹性索引

DECLARE_UNIQUE_INDEX(pg_partition_key_relid_index, 3181, on pg_partition_key using btree(pkrelid oid_ops));

#define PartitionKeyRelidIndexId 3181 r>3) Syscache -- 以 pg_partion_key為例:

3.1)首先要在syscache.h中添加 SysCacheIdentifier

3.2) 要在syscache.c 的 cacheinfo[] 中添加這張表

cache的定義:

struct cachedesc

{

  • 上一篇:安卓最新版本是多少?
  • 下一篇:我們公司想要壹個電子郵件系統,可以定期向客戶發送html之類的漂亮電子郵件。如何做到這壹點?
  • copyright 2024編程學習大全網