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

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: a width specification for s specifier (format function), fix behave when positional and ordered placeholders are used
Date: 2013-01-26 10:58:32
Message-ID: CAFj8pRApLCSz7P1nN61b3E6bq=0=jGyNKPVj_7aKtQj=nmW2Bw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

2012/12/31 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:
> Hello
>
> 2012/12/31 Stephen Frost <sfrost(at)snowman(dot)net>:
>> Pavel,
>>
>> * Pavel Stehule (pavel(dot)stehule(at)gmail(dot)com) wrote:
>>> 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
>>
>> Alright, then I agree that raising a warning in that case makes sense
>> and let's update the docs to reflect that it shouldn't be done (like
>> what glibc/gcc do).
>
> so there are two patches - first is fix in logic when positional and
> ordered parameters are mixed + add warning in this situation. Second
> patch enables possibility to specify width for %s conversion.
>
> I didn't finalize documentation due my net good English skills -
> probably there is necessary new paragraph about function "format"
> elsewhere than in table
>
> Regards
>
> Pavel

updated patches due changes for better variadic "any" function.

apply fix_mixing_positinal_ordered_placeholders_warnings_20130126.patch first

Regards

Pavel

Attachment Content-Type Size
fix_mixing_positinal_ordered_placeholders_warnings_20130126.patch application/octet-stream 4.7 KB
format_width_20130126.patch application/octet-stream 14.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2013-01-26 11:04:56 WIP patch for pl/python cstring and type io support (was: Re: Is there a good reason why PL languages do not support cstring type arguments and return values ?)
Previous Message Bernd Helmle 2013-01-26 10:58:19 Re: Hanging backends and possible index corruption