codekingpro/portable-devtools
114k
1/*-------------------------------------------------------------------------2 *3 * pg_collation.h4 * definition of the "collation" system catalog (pg_collation)5 *6 *7 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group8 * Portions Copyright (c) 1994, Regents of the University of California9 *10 * src/include/catalog/pg_collation.h11 *12 * NOTES13 * The Catalog.pm module reads this file and derives schema14 * information.15 *16 *-------------------------------------------------------------------------17 */18#ifndef PG_COLLATION_H19#define PG_COLLATION_H20 21#include "catalog/genbki.h"22#include "catalog/pg_collation_d.h"23 24/* ----------------25 * pg_collation definition. cpp turns this into26 * typedef struct FormData_pg_collation27 * ----------------28 */29CATALOG(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 collicurules BKI_DEFAULT(_null_); /* ICU collation rules */47 text collversion BKI_DEFAULT(_null_); /* provider-dependent48 * version of collation49 * data */50#endif51} FormData_pg_collation;52 53/* ----------------54 * Form_pg_collation corresponds to a pointer to a row with55 * the format of pg_collation relation.56 * ----------------57 */58typedef FormData_pg_collation *Form_pg_collation;59 60DECLARE_TOAST(pg_collation, 6175, 6176);61 62DECLARE_UNIQUE_INDEX(pg_collation_name_enc_nsp_index, 3164, CollationNameEncNspIndexId, on pg_collation using btree(collname name_ops, collencoding int4_ops, collnamespace oid_ops));63DECLARE_UNIQUE_INDEX_PKEY(pg_collation_oid_index, 3085, CollationOidIndexId, on pg_collation using btree(oid oid_ops));64 65#ifdef EXPOSE_TO_CLIENT_CODE66 67#define COLLPROVIDER_DEFAULT 'd'68#define COLLPROVIDER_ICU 'i'69#define COLLPROVIDER_LIBC 'c'70 71static inline const char *72collprovider_name(char c)73{74 switch (c)75 {76 case COLLPROVIDER_ICU:77 return "icu";78 case COLLPROVIDER_LIBC:79 return "libc";80 default:81 return "???";82 }83}84 85#endif /* EXPOSE_TO_CLIENT_CODE */86 87 88extern Oid CollationCreate(const char *collname, Oid collnamespace,89 Oid collowner,90 char collprovider,91 bool collisdeterministic,92 int32 collencoding,93 const char *collcollate, const char *collctype,94 const char *colliculocale,95 const char *collicurules,96 const char *collversion,97 bool if_not_exists,98 bool quiet);99 100#endif /* PG_COLLATION_H */101 