Re: [BUGS] BUG #14800: substring produces different results withsimilar types - Mailing list pgsql-bugs

From Francisco Olarte
Subject Re: [BUGS] BUG #14800: substring produces different results withsimilar types
Date
Msg-id CA+bJJbygqhGsFqPG7sf4wmk3fn6D00GsD5dFpuFithLeMo-M8Q@mail.gmail.com
Whole thread Raw
In response to Re: [BUGS] BUG #14800: substring produces different results with similar types  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Tom:

On Wed, Sep 6, 2017 at 4:51 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Francisco Olarte <folarte@peoplecall.com> writes:
>> Anyway, you may notice char() discards trailing blanks, varchar does not:
> More precisely, converting from char(n) to varchar or text discards
> trailing blanks.  Since both substring() and the || operator take
> text argument types, an implicit coercion to text is happening in
> these examples ... and that's where the blanks went.

I was suspecting that, but
https://www.postgresql.org/docs/9.6/static/functions-string.html
documents them as "string || string", returns text, and
"substring(string {several variants})", returns text and trying to
look where the conversion to text happened ( i.e., in the arguments,
or after aplying overloaded variants ) seemed a bit extreme. Not
surprising, anyway, of the space chopping, having worked with punched
cards I'm used to it.


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

pgsql-bugs by date:

Previous
From: davidr@openscg.com
Date:
Subject: [BUGS] BUG #14801: ECPG core dump
Next
From: Francisco Olarte
Date:
Subject: Re: [BUGS] BUG #14800: substring produces different results withsimilar types