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-02-09 18:30:17
Message-ID: CAFj8pRDgmfEzo4H9wvXEK=76OysXVY3EZcejSwfGJFt5o4DWqw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2013/2/9 Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>:
>> 2013/1/31 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:
>>> I am sending rewritten code
>
> Nice. I think this will be very useful, and it looks like it now
> supports everything that printf() does for %s format specifiers, and
> it's good that %I and %L behave the same. Also the code is looking
> cleaner.
>
>>> 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")
>>>
>>> ???
>
> My first thought is that a NULL width should be treated the same as no
> width at all (equivalent to width=0), rather than raising an
> exception.
>
>> minor update - fix align NULL for %L
>
> You need to do the same for a NULL value with %s, which currently
> produces an empty string regardless of the width.

have others same opinion? Usually I don't like hide NULLs, but this is
corner case (and specific function) and I have not strong opinion on
this issue.

>
> The documentation also needs to be updated. I'm thinking perhaps
> format() should now have its own separate sub-section in the manual,
> rather than trying to cram it's docs into a single table row. I can
> help with the docs if you like.

please, if you can, write it. I am sure, so you do it significantly
better than me.

Thank you

Pavel

>
> Regards,
> Dean

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vitalii Tymchyshyn 2013-02-09 19:24:57 Re: [JDBC] JPA + enum == Exception
Previous Message Noah Misch 2013-02-09 18:23:12 Re: pgcrypto seeding problem when ssl=on