From: | "Dickson S(dot) Guedes" <listas(at)guedesoft(dot)net> |
---|---|
To: | Tatsuo Ishii <ishii(at)postgresql(dot)org> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Pavel Stěhule <pavel(dot)stehule(at)gmail(dot)com>, pg-dev <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Why format() adds double quote? |
Date: | 2016-01-24 22:54:44 |
Message-ID: | CAHHcreoSQ7EEzy_PojOftZs8kyvbrQp=Yah06zwctk_RxHL5pg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2016-01-24 8:04 GMT-02:00 Tatsuo Ishii <ishii(at)postgresql(dot)org>:
>> On Wed, Jan 20, 2016 at 4:20 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>>>> If we would go this way, question is if we should back patch this or
>>>> not since the patch apparently changes the existing
>>>> behaviors. Comments? I would think we should not.
>>>
>>> I am sure, so we should not backport this change. This can breaks customer
>>> regress tests - and the current behave isn't 100% correct, but it is safe.
>>
>> Quite. This is not a bug fix. It's a behavior change, perhaps for the better.
>
> Added to the commitfest 2016-03.
Hi,
I gone ahead a little and tested this patch and it works like was
proposed, I agree that it's not a bug fix but a new behavior so -1 for
backport.
While applying patch against master
(1129c2b0ad2732f301f696ae2cf98fb063a4c1f8) it offsets two hunks.
Since format() has regression tests I suggest that one should be added
to cover this. It could worth to add the new behavior to the docs,
since there no explicit example for %I.
I performed the follow tests that works as expected using some Portuguese words:
postgres=# create table test (nome varchar, endereço text, "UF"
varchar(2), título varchar);
CREATE TABLE
Time: 80,769 ms
postgres=# select format('%I', attname) from pg_attribute join
pg_class on (attrelid = oid) where relname = 'test';
format
----------
"UF"
cmax
cmin
ctid
endereço
nome
tableoid
título
xmax
xmin
(10 rows)
Time: 1,728 ms
postgres=# select format('%I', 'endereco');
format
----------
endereco
(1 row)
Time: 0,098 ms
postgres=# select format('%I', 'endereço');
format
----------
endereço
(1 row)
Time: 0,088 ms
postgres=# select format('%I', 'あああ');
format
--------
あああ
(1 row)
Time: 0,072 ms
postgres=# select format('%I', 'título');
format
--------
título
(1 row)
Time: 0,051 ms
postgres=# select format('%I', 'título e');
format
------------
"título e"
(1 row)
Time: 0,051 ms
postgres=# select format('%I', 'título_e');
format
----------
título_e
(1 row)
Time: 0,051 ms
postgres=# select format('%I', '_título');
format
---------
_título
(1 row)
Time: 0,047 ms
postgres=# select format('%I', '1_título');
format
------------
"1_título"
(1 row)
Time: 0,046 ms
Thank you for this!
Best regards,
--
Dickson S. Guedes
mail/xmpp: guedes(at)guedesoft(dot)net - skype: guediz
http://github.com/guedes - http://guedesoft.net
http://www.postgresql.org.br
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Janes | 2016-01-25 00:32:29 | Re: WIP: Covering + unique indexes. |
Previous Message | Tom Lane | 2016-01-24 21:41:30 | Re: easy way of copying regex_t |