Re: [BUGS] BUG #14800: substring produces different results withsimilar types
От | Francisco Olarte |
---|---|
Тема | Re: [BUGS] BUG #14800: substring produces different results withsimilar types |
Дата | |
Msg-id | CA+bJJbza+Zhj_mq2ovFLkY_u_iqTCecqkbXhYmugA+rHWjiK5Q@mail.gmail.com обсуждение исходный текст |
Ответ на | [BUGS] BUG #14800: substring produces different results with similar types (kostin.artem@gmail.com) |
Ответы |
Re: [BUGS] BUG #14800: substring produces different results with similar types
|
Список | pgsql-bugs |
Kostin: On Wed, Sep 6, 2017 at 3:21 PM, <kostin.artem@gmail.com> wrote: > These two commands produce different results with similar types > select substring(cast(' 2345 ' as character(16)), 1, 7) || '?', > substring(cast(' 2345 ' as varchar(16)), 1, 7) || '?'; > > " 2345?";" 2345 ?" > > Should it work in this way or not? If you are not sure whether something is a bug, you should try asking in the general list, to avoid noise. Anyway, you may notice char() discards trailing blanks, varchar does not: n=> select cast(' 2345 ' as character(16)) || '?';?column? ---------- 2345? (1 row) Plain char is STORED space padded and TRUNCATED if too long ( standard required IIRC ), and trailing spaces are disregarded in many places, such as when concatenating. Francisco Olarte. -- 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 по дате отправления: