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

From David G. Johnston
Subject Re: [BUGS] BUG #14800: substring produces different results withsimilar types
Date
Msg-id CAKFQuwb75rbbifwgOqHSMxmgh2_OAr6179Y+OYtxfczuZ=roCQ@mail.gmail.com
Whole thread Raw
In response to Re: [BUGS] BUG #14800: substring produces different results withsimilar types  (Артём Костин <kostin.artem@gmail.com>)
List pgsql-bugs
On Wed, Sep 6, 2017 at 10:10 AM, Артём Костин <kostin.artem@gmail.com> wrote:
I'm sorry for this approach.

The main point is that behaviour are not applied to all character types described in docs. You can see it in my example.

​There is only one "character type" in PostgreSQL, it is spelled "character" (char is a valid alias).


For the second point, please, check chapter 8.3 for this
"Trailing spaces are removed when converting a character value to one of the other string types. Note that trailing spaces are semantically significant in character varying and text values, and when using pattern matching, that is LIKE and regular expressions."


IOW, ​The "character" data type is one of three "string-class" types in the PostgreSQL system.  "character" has no concept of "semantically significant trailing whitespace".  Therefore when converting from "character" to one of the other two "string-class" types (varchar, text) you will never end up with a resultant value with trailing whitespace.

​David J.

pgsql-bugs by date:

Previous
From: "Wood, Dan"
Date:
Subject: Re: [BUGS] Old row version in hot chain become visible after a freeze
Next
From: Patrick van Coeverden
Date:
Subject: [BUGS] Line number in error message is incorrect when loading a CSV-filewith multi-line records.