Re: why do i get 2 as answer for select length('aa '::char(6));

Поиск
Список
Период
Сортировка
От RABIN NATHAN
Тема Re: why do i get 2 as answer for select length('aa '::char(6));
Дата
Msg-id 8FA2EC8C-636F-490D-A2AD-63D120E49DFB@shaw.ca
обсуждение исходный текст
Ответ на Re: why do i get 2 as answer for select length('aa '::char(6));  (john snow <ofbizfanster@gmail.com>)
Список pgsql-novice
Does anybody know how I get of this list?

Rabindra Nathan from mobile device. 

On Jan 16, 2018, at 7:38 PM, john snow <ofbizfanster@gmail.com> wrote:

thanks! you are right. we're porting a 20 year old xbase app and it's painful

On Wed, Jan 17, 2018 at 11:32 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
john snow <ofbizfanster@gmail.com> writes:
> when you say char-type values, do you include varchar?

No.  varchar and text consider trailing spaces to be significant.

To my mind, there are very few situations where char(n) is actually
a reasonable choice of datatype.  Maybe for US state abbreviations
or the like.  If you're even asking this question, it suggests that
you ought to be using varchar/text.

char(n) basically exists to support fixed-field-width data designs that
should have died along with the punched cards that inspired them.

                        regards, tom lane

В списке pgsql-novice по дате отправления:

Предыдущее
От: john snow
Дата:
Сообщение: Re: why do i get 2 as answer for select length('aa '::char(6));
Следующее
От: "jlymarius@yahoo.com"
Дата:
Сообщение: Restarting PostgreSQL 10.1