pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: vodevsh@gmail.com
To: pgsql-docs@postgresql.org
Subject: tip to workaround trailing spaces removal on char to varchar conversion
Date: Wed, 20 Sep 2017 12:46:26 +0000
Message-ID: <20170920124626.17363.48015@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-docs>

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/9.6/static/datatype-character.html
Description:

removing trailing spaces on (implicit) cast from char to text can be
painful, and always surprising as shown in example with 
SELECT &#39;a &#39;::CHAR(2) collate &quot;C&quot; &lt; E&#39;a\n&#39;::CHAR(2)

would it be worth mentioning a tip, that this behaviour can be monkey hacked
by concat(str &quot;any&quot; function that accepts char and returns text, thus
respecting the spaces, eg SELECT concat(&#39;a &#39;::CHAR(2) collate &quot;C&quot;) &lt;
E&#39;a\n&#39;::CHAR(2) will return false as expected...

-- 
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs


Message-ID: <20170920124626.17363.48015@wrigleys.postgresql.org>
Permalink:  ../20170920124626.17363.48015@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20170920124626.17363.48015@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: vodevsh@gmail.com
  Subject: Re: tip to workaround trailing spaces removal on char to varchar conversion
  In-Reply-To: <20170920124626.17363.48015@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox