codekingpro/portable-devtools
114k
1/*-------------------------------------------------------------------------2 *3 * pg_statistic_ext.h4 * definition of the "extended statistics" system catalog5 * (pg_statistic_ext)6 *7 * Note that pg_statistic_ext contains the definitions of extended statistics8 * objects, created by CREATE STATISTICS, but not the actual statistical data,9 * created by running ANALYZE.10 *11 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group12 * Portions Copyright (c) 1994, Regents of the University of California13 *14 * src/include/catalog/pg_statistic_ext.h15 *16 * NOTES17 * The Catalog.pm module reads this file and derives schema18 * information.19 *20 *-------------------------------------------------------------------------21 */22#ifndef PG_STATISTIC_EXT_H23#define PG_STATISTIC_EXT_H24 25#include "catalog/genbki.h"26#include "catalog/pg_statistic_ext_d.h"27 28/* ----------------29 * pg_statistic_ext definition. cpp turns this into30 * typedef struct FormData_pg_statistic_ext31 * ----------------32 */33CATALOG(pg_statistic_ext,3381,StatisticExtRelationId)34{35 Oid oid; /* oid */36 37 Oid stxrelid BKI_LOOKUP(pg_class); /* relation containing38 * attributes */39 40 /* These two fields form the unique key for the entry: */41 NameData stxname; /* statistics object name */42 Oid stxnamespace BKI_LOOKUP(pg_namespace); /* OID of statistics43 * object's namespace */44 45 Oid stxowner BKI_LOOKUP(pg_authid); /* statistics object's owner */46 int32 stxstattarget BKI_DEFAULT(-1); /* statistics target */47 48 /*49 * variable-length fields start here, but we allow direct access to50 * stxkeys51 */52 int2vector stxkeys BKI_FORCE_NOT_NULL; /* array of column keys */53 54#ifdef CATALOG_VARLEN55 char stxkind[1] BKI_FORCE_NOT_NULL; /* statistics kinds requested56 * to build */57 pg_node_tree stxexprs; /* A list of expression trees for stats58 * attributes that are not simple column59 * references. */60#endif61 62} FormData_pg_statistic_ext;63 64/* ----------------65 * Form_pg_statistic_ext corresponds to a pointer to a tuple with66 * the format of pg_statistic_ext relation.67 * ----------------68 */69typedef FormData_pg_statistic_ext *Form_pg_statistic_ext;70 71DECLARE_TOAST(pg_statistic_ext, 3439, 3440);72 73DECLARE_UNIQUE_INDEX_PKEY(pg_statistic_ext_oid_index, 3380, StatisticExtOidIndexId, on pg_statistic_ext using btree(oid oid_ops));74DECLARE_UNIQUE_INDEX(pg_statistic_ext_name_index, 3997, StatisticExtNameIndexId, on pg_statistic_ext using btree(stxname name_ops, stxnamespace oid_ops));75DECLARE_INDEX(pg_statistic_ext_relid_index, 3379, StatisticExtRelidIndexId, on pg_statistic_ext using btree(stxrelid oid_ops));76 77DECLARE_ARRAY_FOREIGN_KEY((stxrelid, stxkeys), pg_attribute, (attrelid, attnum));78 79#ifdef EXPOSE_TO_CLIENT_CODE80 81#define STATS_EXT_NDISTINCT 'd'82#define STATS_EXT_DEPENDENCIES 'f'83#define STATS_EXT_MCV 'm'84#define STATS_EXT_EXPRESSIONS 'e'85 86#endif /* EXPOSE_TO_CLIENT_CODE */87 88#endif /* PG_STATISTIC_EXT_H */89 