@@ -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