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

From Pavel Stehule
Subject Re: Re: proposal: a width specification for s specifier (format function), fix behave when positional and ordered placeholders are used
Date
Msg-id CAFj8pRAhLdZDXXTunJbuKMHsWFjHYxPp+SMuExU8z_FE1XMc7A@mail.gmail.com
Whole thread Raw
In response to Re: Re: proposal: a width specification for s specifier (format function), fix behave when positional and ordered placeholders are used  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: Re: proposal: a width specification for s specifier (format function), fix behave when positional and ordered placeholders are used  (Dean Rasheed <dean.a.rasheed@gmail.com>)
List pgsql-hackers
Hello

minor update - fix align NULL for %L

Regards

Pavel

2013/1/31 Pavel Stehule <pavel.stehule@gmail.com>:
> Hello
>
> 2013/1/29 Dean Rasheed <dean.a.rasheed@gmail.com>:
>> On 29 January 2013 08:19, Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
>>> * The width field is optional, even if the '-' flag is specified. So
>>> '%-s' is perfectly legal and should be interpreted as '%s'. The
>>> current implementation treats it as a width of 0, which is wrong.
>>>
>>
>> Oh, but of course a width of 0 is the same as no width at all, so the
>> current code is correct after all. That's what happens if I try to
>> write emails before I've had my caffeine :-)
>>
>> I think my other points remain valid though. It would still be neater
>> to parse the flags separately from the width field, and then all
>> literal numbers that appear in the format should be positive.
>
> I am sending rewritten code
>
> It indirect width "*" and "*n$" is supported. It needs little bit more code.
>
> There are a new question
>
> what should be result of
>
> format(">>%2$*1$s<<", NULL, "hello")
>
> ???
>
> raise exception now, but I am able to modify to some agreement
>
> Regards
>
> Pavel
>
>
>
>
>
>>
>> Regards,
>> Dean

Attachment

pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: proposal - assign result of query to psql variable
Next
From: Peter Geoghegan
Date:
Subject: Re: Cascading replication: should we detect/prevent cycles?