Re: Why format() adds double quote?

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tatsuo Ishii <ishii(at)postgresql(dot)org>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why format() adds double quote?
Date: 2016-01-20 05:36:00
Message-ID: CAFj8pRAg-w7u4RdP4zdRRbKRJGNSnn1ENxBMuqoe3zFp-fcPgg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2016-01-20 3:47 GMT+01:00 Tatsuo Ishii <ishii(at)postgresql(dot)org>:

> test=# select format('%I', t) from t1;
> format
> ----------
> aaa
> "AAA"
> "あいう"
> (3 rows)
>
> Why is the text value of the third line needed to be double quoted?
> (note that it is a multi byte character). Same thing can be said to
> quote_ident().
>
> We treat identifiers made of the multi byte characters without double
> quotation (non delimited identifier) in other places.
>
> test=# create table t2(あいう text);
> CREATE TABLE
> test=# insert into t2 values('aaa');
> INSERT 0 1
> test=# select あいう from t2;
> あいう
> --------
> aaa
> (1 row)
>

format uses same routine as quote_ident. So quote_ident should be fixed
first.

Regards

Pavel

>
> Best regards,
> --
> Tatsuo Ishii
> SRA OSS, Inc. Japan
> English: http://www.sraoss.co.jp/index_en.php
> Japanese:http://www.sraoss.co.jp
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2016-01-20 05:48:52 Re: Rethinking TRANSFORM FOR TYPE ...
Previous Message Masahiko Sawada 2016-01-20 05:35:02 Re: Support for N synchronous standby servers - take 2