Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and--lc-collate

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and--lc-collate
Дата
Msg-id 20200227051112.GA280980@paquier.xyz
обсуждение исходный текст
Ответ на Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and--lc-collate  (Michael Paquier <michael@paquier.xyz>)
Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and--lc-collate  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-committers
On Thu, Feb 27, 2020 at 09:43:14AM +0530, Robert Haas wrote:
> Buildfarm member curculio just failed with this complaint:

Thanks, I missed this report.

> #   Failed test 'createdb with incorrect --lc-ctype stderr
> /(?^s:^createdb: error: database creation failed: ERROR:  invalid
> locale name)/'
> #   at t/020_createdb.pl line 43.
> #                   'createdb: error: database creation failed: ERROR:
>  new LC_CTYPE (foo'; SELECT '1) is incompatible with the LC_CTYPE of
> the template database (C)
> # HINT:  Use the same LC_CTYPE as in the template database, or use
> template0 as template.

Now that's interesting.  The error I would have expected to find is
from createdb() so as we should actually bump on a failure for
setlocale(LC_CTYPE).  But this means that setlocale() with an
incorrect value actually succeeded, and that the fallback became "C".
Oh, actually, this behavior is mentioned here:
https://man.openbsd.org/setlocale.3

The best thing I can think of is just to remove the test case for
--lc-ctype.  Now looking at the code of OpenBSD there could be an
alternative: using a string longer than 256 characters if I read
lib/libc/locale/setlocale.c correctly, but I'd rather not rely on
that.

Thoughts?
--
Michael

Вложения

В списке pgsql-committers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate
Следующее
От: Michael Paquier
Дата:
Сообщение: pgsql: Skip foreign tablespaces when running pg_checksums/pg_verify_che