Re: Why format() adds double quote?
От | Dickson S. Guedes |
---|---|
Тема | Re: Why format() adds double quote? |
Дата | |
Msg-id | CAHHcreoSQ7EEzy_PojOftZs8kyvbrQp=Yah06zwctk_RxHL5pg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Why format() adds double quote? (Tatsuo Ishii <ishii@postgresql.org>) |
Ответы |
Re: Why format() adds double quote?
|
Список | pgsql-hackers |
2016-01-24 8:04 GMT-02:00 Tatsuo Ishii <ishii@postgresql.org>: >> On Wed, Jan 20, 2016 at 4:20 AM, Pavel Stehule <pavel.stehule@gmail.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"cmaxcminctidendereçonometableoidtítuloxmaxxmin (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@guedesoft.net - skype: guediz http://github.com/guedes - http://guedesoft.net http://www.postgresql.org.br
В списке pgsql-hackers по дате отправления: