PostgreSQL Source Code  git master
pg_collation.h
Go to the documentation of this file.
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 
21 #include "catalog/genbki.h"
22 #include "catalog/pg_collation_d.h"
23 
24 /* ----------------
25  * pg_collation definition. cpp turns this into
26  * typedef struct FormData_pg_collation
27  * ----------------
28  */
29 CATALOG(pg_collation,3456,CollationRelationId)
30 {
31  Oid oid; /* oid */
32  NameData collname; /* collation name */
33 
34  /* OID of namespace containing this collation */
35  Oid collnamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace);
36 
37  /* owner of collation */
38  Oid collowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid);
39  char collprovider; /* see constants below */
40  bool collisdeterministic BKI_DEFAULT(t);
41  int32 collencoding; /* encoding for this collation; -1 = "all" */
42 #ifdef CATALOG_VARLEN /* variable-length fields start here */
43  text collcollate BKI_DEFAULT(_null_); /* LC_COLLATE setting */
44  text collctype BKI_DEFAULT(_null_); /* LC_CTYPE setting */
45  text colliculocale BKI_DEFAULT(_null_); /* ICU locale ID */
46  text collversion BKI_DEFAULT(_null_); /* provider-dependent
47  * version of collation
48  * data */
49 #endif
51 
52 /* ----------------
53  * Form_pg_collation corresponds to a pointer to a row with
54  * the format of pg_collation relation.
55  * ----------------
56  */
58 
59 DECLARE_TOAST(pg_collation, 6175, 6176);
60 
61 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));
62 DECLARE_UNIQUE_INDEX_PKEY(pg_collation_oid_index, 3085, CollationOidIndexId, on pg_collation using btree(oid oid_ops));
63 
64 #ifdef EXPOSE_TO_CLIENT_CODE
65 
66 #define COLLPROVIDER_DEFAULT 'd'
67 #define COLLPROVIDER_ICU 'i'
68 #define COLLPROVIDER_LIBC 'c'
69 
70 static inline const char *
71 collprovider_name(char c)
72 {
73  switch (c)
74  {
75  case COLLPROVIDER_ICU:
76  return "icu";
77  case COLLPROVIDER_LIBC:
78  return "libc";
79  default:
80  return "???";
81  }
82 }
83 
84 #endif /* EXPOSE_TO_CLIENT_CODE */
85 
86 
87 extern Oid CollationCreate(const char *collname, Oid collnamespace,
88  Oid collowner,
89  char collprovider,
90  bool collisdeterministic,
91  int32 collencoding,
92  const char *collcollate, const char *collctype,
93  const char *colliculocale,
94  const char *collversion,
95  bool if_not_exists,
96  bool quiet);
97 
98 #endif /* PG_COLLATION_H */
signed int int32
Definition: c.h:429
#define BKI_LOOKUP(catalog)
Definition: genbki.h:46
#define BKI_DEFAULT(value)
Definition: genbki.h:35
FormData_pg_collation * Form_pg_collation
Definition: pg_collation.h:57
CATALOG(pg_collation, 3456, CollationRelationId)
Definition: pg_collation.h:29
DECLARE_TOAST(pg_collation, 6175, 6176)
DECLARE_UNIQUE_INDEX_PKEY(pg_collation_oid_index, 3085, CollationOidIndexId, on pg_collation using btree(oid oid_ops))
FormData_pg_collation
Definition: pg_collation.h:50
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))
Oid CollationCreate(const char *collname, Oid collnamespace, Oid collowner, char collprovider, bool collisdeterministic, int32 collencoding, const char *collcollate, const char *collctype, const char *colliculocale, const char *collversion, bool if_not_exists, bool quiet)
Definition: pg_collation.c:46
unsigned int Oid
Definition: postgres_ext.h:31
char * c
Definition: c.h:676
Definition: c.h:622