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

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

2012/12/31 Stephen Frost <sfrost@snowman.net>:
> Pavel,
>
> * Pavel Stehule (pavel.stehule@gmail.com) wrote:
>> I found one issue - if I disallow mixing positional and ordered style
>> I break compatibility with previous implementation.
>
> Can you elaborate?  In the previous example, an error was returned when
> mixing (not a terribly good one, but still an error).  Returning a
> better error won't be a problem.

A result from ours previous talk was a completely disabling mixing
positional and ordered placeholders - like is requested by man and gcc
raises warnings there.

But mixing is not explicitly disallowed in doc, and mixing was tested
in our regress tests. There are tests where placeholders are mixed -
so anybody can use it.

select format('Hello %s %1$s %s', 'World', 'Hello again'); -- is
enabled and supported and result is expected

-- but this raises error - and it is same situation like previous example
select format('%s %2$s %s', 'Hello', 'World');

-- so bot examples should be executed or should be disabled if this
functionality should be consistent. And I can't to break first
example, then I have to repair second example

Regards


>
>> so maybe third way is better - use fix from my patch - a behave is
>> same like in glibc - and raise warning (instead errors) when mixing
>> styles is detected - we can replace warnings by errors in future.
>>
>> What do you think?
>
> If there are cases which work today then I agree that we should issue a
> warning to avoid breaking existing applications.  We should still use
> the glibc format when adding width support, however.
>
>         Thanks,
>
>                 Stephen



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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Event Triggers: adding information
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Documentation bug for LDAP authentication