Re: Why format() adds double quote?

From: "Dickson S(dot) Guedes" <listas(at)guedesoft(dot)net>
To: Daniel Verite <daniel(at)manitou-mail(dot)org>
Cc: Tatsuo Ishii <ishii(at)postgresql(dot)org>, 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-26 22:29:20
Message-ID: CAHHcrepPun4=-cVJc9cZQtuw0mP6-kKAbfT_+bU3LZkw2t-hvA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2016-01-26 18:00 GMT-02:00 Daniel Verite <daniel(at)manitou-mail(dot)org>:
> ...
> create table abc(U&"foo\2003" int);
>
> U+2003 is 'EM SPACE', in Unicode's General Punctuation block.
>
> With the current version, format('%I', attname) on this column is:
> "foo "
>
> With the patched version, it produces this:
> foo
>
> So the visual hint that there are more characters at the end is lost.

Thanks for advocate, I see here that it even produces that output with
simple spaces.

postgres=# create table x ("aí " text);
CREATE TABLE
postgres=# \d x
Tabela "public.x"
Coluna | Tipo | Modificadores
----------+------+---------------
aí | text |

This will break copy&paste user actions and scripts that parses that output.

Maybe the patch should consider left/right non-printable chars to
choose whether to show or not the " ?

[]s
--
Dickson S. Guedes
mail/xmpp: guedes(at)guedesoft(dot)net - skype: guediz
http://github.com/guedes - http://guedesoft.net
http://www.postgresql.org.br

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2016-01-26 23:17:55 Re: pgbench stats per script & other stuff
Previous Message Dickson S. Guedes 2016-01-26 22:04:06 Re: Why format() adds double quote?