Re: proposal: a width specification for s specifier (format function), fix behave when positional and ordered placeholders are used

Поиск
Список
Период
Сортировка
От Stephen Frost
Тема Re: proposal: a width specification for s specifier (format function), fix behave when positional and ordered placeholders are used
Дата
Msg-id 20121229184459.GU16126@tamriel.snowman.net
обсуждение исходный текст
Ответ на proposal: a width specification for s specifier (format function), fix behave when positional and ordered placeholders are used  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: proposal: a width specification for s specifier (format function), fix behave when positional and ordered placeholders are used
Список pgsql-hackers
Pavel,

* Pavel Stehule (pavel.stehule@gmail.com) wrote:
> I found so we doesn't have functionality for simply text aligning - so
> I propose support width for %s like printf's behave. glibc
> implementation knows a rule for precision, that I don't would to
> implement, because it is oriented to bytes and not to chars - and it
> can be confusing. Still I would to have implementation and design of
> "format" function maximally simple - and a rule for "s" specifier and
> width is clean and simple.

I started looking at this patch to get a head-start on the next
commitfest.  There's no documentation, which certainly needs to be
fixed, but worse, this doesn't appear to match glibc printf and it's not
entirely clear to me why it doesn't.

> -- our current behave
> postgres=# select format('%s %2$s %s', 'Hello', 'World');
> ERROR:  too few arguments for format
> postgres=#

This is correct, if we're matching glibc (and SUS, I believe), isn't it?
You're not allowed to mix '%2$s' type parameters and '%s' in a single
format.
Thanks,
    Stephen

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

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: enhanced error fields
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: proposal: a width specification for s specifier (format function), fix behave when positional and ordered placeholders are used