Skip site navigation (1) Skip section navigation (2)

Re: 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: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: proposal: a width specification for s specifier (format function), fix behave when positional and ordered placeholders are used
Date: 2013-01-31 20:43:24
Message-ID: CAFj8pRC0pYF4pAa4N=OVCwHLLJ-Mj4YxhJ+_OU0iZS8EnLzbhw@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Hello

2013/1/29 Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>:
> On 29 January 2013 08:19, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)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: format_width_20130131.patch
Description: application/octet-stream (17.5 KB)

In response to

Responses

pgsql-hackers by date

Next:From: Peter EisentrautDate: 2013-01-31 20:49:36
Subject: Re: Privileges for INFORMATION_SCHEMA.SCHEMATA (was Re: Small clarification in "34.41. schemata")
Previous:From: Peter EisentrautDate: 2013-01-31 20:41:21
Subject: Re: backend hangs at immediate shutdown (Re: Back-branch update releases coming in a couple weeks)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group