Skip to content

Commit 24a326c

Browse files
authored
Merge pull request #56 from cybertec-postgresql/fixICU
fix using icu for pg15 or newer only
2 parents 82b71c2 + f1601c2 commit 24a326c

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

pkg/cluster/k8sres.go

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -328,12 +328,23 @@ func generateSpiloJSONConfiguration(pg *cpov1.PostgresqlParam, patroni *cpov1.Pa
328328

329329
config.Bootstrap = pgBootstrap{}
330330

331-
config.Bootstrap.Initdb = []interface{}{map[string]string{"auth-host": "scram-sha-256"},
332-
map[string]string{"auth-local": "trust"},
333-
map[string]string{"encoding": "UTF8"},
334-
map[string]string{"locale": "en_US.UTF-8"},
335-
map[string]string{"locale-provider": "icu"},
336-
map[string]string{"icu-locale": "en_US"}}
331+
pgVersion, err := strconv.Atoi(pg.PgVersion)
332+
if err != nil {
333+
fmt.Println("Problem to get PGVersion:", err)
334+
pgVersion = 16
335+
}
336+
if pgVersion > 14 {
337+
config.Bootstrap.Initdb = []interface{}{map[string]string{"auth-host": "scram-sha-256"},
338+
map[string]string{"auth-local": "trust"},
339+
map[string]string{"encoding": "UTF8"},
340+
map[string]string{"locale": "en_US.UTF-8"},
341+
map[string]string{"locale-provider": "icu"},
342+
map[string]string{"icu-locale": "en_US"}}
343+
} else {
344+
config.Bootstrap.Initdb = []interface{}{map[string]string{"auth-host": "scram-sha-256"},
345+
map[string]string{"auth-local": "trust"}}
346+
}
347+
337348
if enableTDE {
338349
config.Bootstrap.Initdb = append(config.Bootstrap.Initdb, map[string]string{"encryption-key-command": "/scripts/pgee/tde.sh"})
339350
}

0 commit comments

Comments
 (0)