pg_collation.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*-------------------------------------------------------------------------
  2. *
  3. * pg_collation.h
  4. * definition of the "collation" system catalog (pg_collation)
  5. *
  6. *
  7. * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
  8. * Portions Copyright (c) 1994, Regents of the University of California
  9. *
  10. * src/include/catalog/pg_collation.h
  11. *
  12. * NOTES
  13. * The Catalog.pm module reads this file and derives schema
  14. * information.
  15. *
  16. *-------------------------------------------------------------------------
  17. */
  18. #ifndef PG_COLLATION_H
  19. #define PG_COLLATION_H
  20. #include "catalog/genbki.h"
  21. #include "catalog/pg_collation_d.h"
  22. /* ----------------
  23. * pg_collation definition. cpp turns this into
  24. * typedef struct FormData_pg_collation
  25. * ----------------
  26. */
  27. CATALOG(pg_collation,3456,CollationRelationId)
  28. {
  29. Oid oid; /* oid */
  30. NameData collname; /* collation name */
  31. /* OID of namespace containing this collation */
  32. Oid collnamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace);
  33. /* owner of collation */
  34. Oid collowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid);
  35. char collprovider; /* see constants below */
  36. bool collisdeterministic BKI_DEFAULT(t);
  37. int32 collencoding; /* encoding for this collation; -1 = "all" */
  38. #ifdef CATALOG_VARLEN /* variable-length fields start here */
  39. text collcollate BKI_DEFAULT(_null_); /* LC_COLLATE setting */
  40. text collctype BKI_DEFAULT(_null_); /* LC_CTYPE setting */
  41. text colliculocale BKI_DEFAULT(_null_); /* ICU locale ID */
  42. text collversion BKI_DEFAULT(_null_); /* provider-dependent
  43. * version of collation
  44. * data */
  45. #endif
  46. } FormData_pg_collation;
  47. /* ----------------
  48. * Form_pg_collation corresponds to a pointer to a row with
  49. * the format of pg_collation relation.
  50. * ----------------
  51. */
  52. typedef FormData_pg_collation *Form_pg_collation;
  53. DECLARE_TOAST(pg_collation, 6175, 6176);
  54. DECLARE_UNIQUE_INDEX(pg_collation_name_enc_nsp_index, 3164, CollationNameEncNspIndexId, on pg_collation using btree(collname name_ops, collencoding int4_ops, collnamespace oid_ops));
  55. DECLARE_UNIQUE_INDEX_PKEY(pg_collation_oid_index, 3085, CollationOidIndexId, on pg_collation using btree(oid oid_ops));
  56. #ifdef EXPOSE_TO_CLIENT_CODE
  57. #define COLLPROVIDER_DEFAULT 'd'
  58. #define COLLPROVIDER_ICU 'i'
  59. #define COLLPROVIDER_LIBC 'c'
  60. static inline const char *
  61. collprovider_name(char c)
  62. {
  63. switch (c)
  64. {
  65. case COLLPROVIDER_ICU:
  66. return "icu";
  67. case COLLPROVIDER_LIBC:
  68. return "libc";
  69. default:
  70. return "???";
  71. }
  72. }
  73. #endif /* EXPOSE_TO_CLIENT_CODE */
  74. extern Oid CollationCreate(const char *collname, Oid collnamespace,
  75. Oid collowner,
  76. char collprovider,
  77. bool collisdeterministic,
  78. int32 collencoding,
  79. const char *collcollate, const char *collctype,
  80. const char *colliculocale,
  81. const char *collversion,
  82. bool if_not_exists,
  83. bool quiet);
  84. #endif /* PG_COLLATION_H */