From: | john snow <ofbizfanster(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-novice <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: why do i get 2 as answer for select length('aa '::char(6)); |
Date: | 2018-01-17 03:37:43 |
Message-ID: | CAE67tvW2RUH2vxksF4OoCb5nVVLt3cHkBKK=paJ2+MJVft1gWw@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
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(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> john snow <ofbizfanster(at)gmail(dot)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
>
From | Date | Subject | |
---|---|---|---|
Next Message | RABIN NATHAN | 2018-01-17 08:10:21 | Re: why do i get 2 as answer for select length('aa '::char(6)); |
Previous Message | Tom Lane | 2018-01-17 03:32:05 | Re: why do i get 2 as answer for select length('aa '::char(6)); |