@@ -36,6 +36,9 @@ const (
3636)
3737
3838// DatabaseSpec is the specification of a Postgresql Database
39+ // +kubebuilder:validation:XValidation:rule="!has(self.builtinLocale) || self.localeProvider == 'builtin'",message="builtinLocale is only available when localeProvider is set to `builtin`"
40+ // +kubebuilder:validation:XValidation:rule="!has(self.icuLocale) || self.localeProvider == 'icu'",message="icuLocale is only available when localeProvider is set to `icu`"
41+ // +kubebuilder:validation:XValidation:rule="!has(self.icuRules) || self.localeProvider == 'icu'",message="icuRules is only available when localeProvider is set to `icu`"
3942type DatabaseSpec struct {
4043 // The corresponding cluster
4144 ClusterRef corev1.LocalObjectReference `json:"cluster"`
@@ -67,44 +70,56 @@ type DatabaseSpec struct {
6770 Encoding string `json:"encoding,omitempty"`
6871
6972 // The locale (cannot be changed)
73+ // Sets the default collation order and character classification in the new database.
7074 // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="locale is immutable"
7175 // +optional
7276 Locale string `json:"locale,omitempty"`
7377
74- // The locale provider (cannot be changed)
75- // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="locale_provider is immutable"
78+ // The LOCALE_PROVIDER (cannot be changed)
79+ // This option sets the locale provider for databases created in the new cluster.
80+ // Available from PostgreSQL 16.
81+ // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="localeProvider is immutable"
7682 // +optional
77- LocaleProvider string `json:"locale_provider ,omitempty"`
83+ LocaleProvider string `json:"localeProvider ,omitempty"`
7884
7985 // The LC_COLLATE (cannot be changed)
80- // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="lc_collate is immutable"
86+ // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="localeCollate is immutable"
8187 // +optional
82- LcCollate string `json:"lc_collate ,omitempty"`
88+ LcCollate string `json:"localeCollate ,omitempty"`
8389
8490 // The LC_CTYPE (cannot be changed)
85- // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="lc_ctype is immutable"
91+ // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="localeCType is immutable"
8692 // +optional
87- LcCtype string `json:"lc_ctype ,omitempty"`
93+ LcCtype string `json:"localeCType ,omitempty"`
8894
8995 // The ICU_LOCALE (cannot be changed)
90- // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="icu_locale is immutable"
96+ // Specifies the ICU locale when the ICU provider is used.
97+ // This option requires `localeProvider` to be set to `icu`.
98+ // Available from PostgreSQL 15.
99+ // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="icuLocale is immutable"
91100 // +optional
92- IcuLocale string `json:"icu_locale ,omitempty"`
101+ IcuLocale string `json:"icuLocale ,omitempty"`
93102
94103 // The ICU_RULES (cannot be changed)
95- // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="icu_rules is immutable"
104+ // Specifies additional collation rules to customize the behavior of the default collation.
105+ // This option requires `localeProvider` to be set to `icu`.
106+ // Available from PostgreSQL 16.
107+ // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="icuRules is immutable"
96108 // +optional
97- IcuRules string `json:"icu_rules ,omitempty"`
109+ IcuRules string `json:"icuRules ,omitempty"`
98110
99111 // The BUILTIN_LOCALE (cannot be changed)
100- // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="builtin_locale is immutable"
112+ // Specifies the locale name when the builtin provider is used.
113+ // This option requires `localeProvider` to be set to `builtin`.
114+ // Available from PostgreSQL 17.
115+ // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="builtinLocale is immutable"
101116 // +optional
102- BuiltinLocale string `json:"builtin_locale ,omitempty"`
117+ BuiltinLocale string `json:"builtinLocale ,omitempty"`
103118
104119 // The COLLATION_VERSION (cannot be changed)
105- // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="collation_version is immutable"
120+ // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="collationVersion is immutable"
106121 // +optional
107- CollationVersion string `json:"collation_version ,omitempty"`
122+ CollationVersion string `json:"collationVersion ,omitempty"`
108123
109124 // True when the database is a template
110125 // +optional
0 commit comments