Make initdb behave sanely when the selected locale has codeset "US-ASCII".
Tom Lane <tgl@sss.pgh.pa.us>
Make initdb behave sanely when the selected locale has codeset "US-ASCII". Per discussion, this should result in defaulting to SQL_ASCII encoding. The original coding could not support that because it conflated selection of SQL_ASCII encoding with not being able to determine the encoding. Adjust pg_get_encoding_from_locale()'s API to distinguish these cases, and fix callers appropriately. Only initdb actually changes behavior, since the other callers were perfectly content to consider these cases equivalent. Per bug #5178 from Boh Yap. Not going to bother back-patching, since no one has complained before and there's an easy workaround (namely, specify the encoding you want).
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/commands/dbcommands.c | modified | +12 −8 |
| src/backend/utils/mb/mbutils.c | modified | +9 −2 |
| src/bin/initdb/initdb.c | modified | +7 −16 |
| src/port/chklocale.c | modified | +16 −10 |