Re: Inconsistencies in the behavior of CHR() function in PG.

From: Christoph Berg <myon(at)debian(dot)org>
To: Prabhat Sahu <prabhat(dot)sahu(at)enterprisedb(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Inconsistencies in the behavior of CHR() function in PG.
Date: 2019-03-29 11:51:58
Message-ID: 20190329115158.GE20294@msg.df7cb.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Re: Prabhat Sahu 2019-03-29 <CANEvxPqaQqojU+XyKrfiwt729P+ZikjYsfn=hQhEzcTKm5iWoQ(at)mail(dot)gmail(dot)com>
> While trying to explore on CHR() function in PG,
> I found that few of the ASCII values are returning hex number values(like
> '\x08', '\x0B')
> and few are executing within SQL (i.e. chr(9) => Horizontal tab, chr(10)
> => Line feed) as below example.

That's not a property of chr(), but generally of the "text" datatype:

# select E'\002'::text;
text
──────
\x02

Non-printable characters are quoted. See also:

# select i, chr(i) from generate_series(1, 256) g(i);

Christoph

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2019-03-29 11:58:45 Re: Add exclusive backup deprecation notes to documentation
Previous Message Michael Paquier 2019-03-29 11:51:38 Re: pgsql: Improve autovacuum logging for aggressive and anti-wraparound ru