Red de conocimiento informático - Material del sitio web - Cómo modificar el código fuente de Postgresql para agregar nuevas tablas del sistema

Cómo modificar el código fuente de Postgresql para agregar nuevas tablas del sistema

1) Agregue el archivo de encabezado del sistema correspondiente al archivo MAKE del catálogo

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

2) Tomando pg_partition_key como ejemplo, cree la tabla:

2.1) Agregue esto en el incluya la definición de la tabla del directorio para agregar una definición para esta tabla

#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;

int16 pkattnum

p>

}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) Agregar un índice único a la tabla del sistema en el índice.

DECLARE_UNIQUE_ INDEX(pg_partition_key_relid_index, 3181, en pg_partition_key usando btree(pkrelid oid_ops));

#define PartitionKeyRelidIndexId 3181 r gt; /p>

p>

3.1) Primero, debe agregar SysCacheIdentifier en syscache.h

3.2) Debe agregar esta tabla en cacheinfo[] en syscache.c

Alta velocidad Definición de caché:

Estructura cachedesc

{