pg_statistic_ext.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*-------------------------------------------------------------------------
  2. *
  3. * pg_statistic_ext.h
  4. * definition of the "extended statistics" system catalog
  5. * (pg_statistic_ext)
  6. *
  7. * Note that pg_statistic_ext contains the definitions of extended statistics
  8. * objects, created by CREATE STATISTICS, but not the actual statistical data,
  9. * created by running ANALYZE.
  10. *
  11. * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
  12. * Portions Copyright (c) 1994, Regents of the University of California
  13. *
  14. * src/include/catalog/pg_statistic_ext.h
  15. *
  16. * NOTES
  17. * The Catalog.pm module reads this file and derives schema
  18. * information.
  19. *
  20. *-------------------------------------------------------------------------
  21. */
  22. #ifndef PG_STATISTIC_EXT_H
  23. #define PG_STATISTIC_EXT_H
  24. #include "catalog/genbki.h"
  25. #include "catalog/pg_statistic_ext_d.h"
  26. /* ----------------
  27. * pg_statistic_ext definition. cpp turns this into
  28. * typedef struct FormData_pg_statistic_ext
  29. * ----------------
  30. */
  31. CATALOG(pg_statistic_ext,3381,StatisticExtRelationId)
  32. {
  33. Oid oid; /* oid */
  34. Oid stxrelid BKI_LOOKUP(pg_class); /* relation containing
  35. * attributes */
  36. /* These two fields form the unique key for the entry: */
  37. NameData stxname; /* statistics object name */
  38. Oid stxnamespace BKI_LOOKUP(pg_namespace); /* OID of statistics
  39. * object's namespace */
  40. Oid stxowner BKI_LOOKUP(pg_authid); /* statistics object's owner */
  41. int32 stxstattarget BKI_DEFAULT(-1); /* statistics target */
  42. /*
  43. * variable-length fields start here, but we allow direct access to
  44. * stxkeys
  45. */
  46. int2vector stxkeys BKI_FORCE_NOT_NULL; /* array of column keys */
  47. #ifdef CATALOG_VARLEN
  48. char stxkind[1] BKI_FORCE_NOT_NULL; /* statistics kinds requested
  49. * to build */
  50. pg_node_tree stxexprs; /* A list of expression trees for stats
  51. * attributes that are not simple column
  52. * references. */
  53. #endif
  54. } FormData_pg_statistic_ext;
  55. /* ----------------
  56. * Form_pg_statistic_ext corresponds to a pointer to a tuple with
  57. * the format of pg_statistic_ext relation.
  58. * ----------------
  59. */
  60. typedef FormData_pg_statistic_ext *Form_pg_statistic_ext;
  61. DECLARE_TOAST(pg_statistic_ext, 3439, 3440);
  62. DECLARE_UNIQUE_INDEX_PKEY(pg_statistic_ext_oid_index, 3380, StatisticExtOidIndexId, on pg_statistic_ext using btree(oid oid_ops));
  63. DECLARE_UNIQUE_INDEX(pg_statistic_ext_name_index, 3997, StatisticExtNameIndexId, on pg_statistic_ext using btree(stxname name_ops, stxnamespace oid_ops));
  64. DECLARE_INDEX(pg_statistic_ext_relid_index, 3379, StatisticExtRelidIndexId, on pg_statistic_ext using btree(stxrelid oid_ops));
  65. DECLARE_ARRAY_FOREIGN_KEY((stxrelid, stxkeys), pg_attribute, (attrelid, attnum));
  66. #ifdef EXPOSE_TO_CLIENT_CODE
  67. #define STATS_EXT_NDISTINCT 'd'
  68. #define STATS_EXT_DEPENDENCIES 'f'
  69. #define STATS_EXT_MCV 'm'
  70. #define STATS_EXT_EXPRESSIONS 'e'
  71. #endif /* EXPOSE_TO_CLIENT_CODE */
  72. #endif /* PG_STATISTIC_EXT_H */