Re: char column with a single space as the default not working

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Peter Gram <peter.m.gram@xxxxxxxxx> writes:
> I think it behaves as expected. Look at my select "select
> encode(charcol::bytea, 'hex') , intcol from z;" it returns 20 which is a
> space in hex

Yeah, the space is stored.  What is probably surprising the OP
is that applying the || operator involves a coercion from "char"
to "text", which strips the defined-to-be-insignificant trailing
space(s) of the "char" value.

As David said, you're best off not using the char type.
The semantics around trailing spaces are too squishy for
my taste, and there's no real advantage compared to varchar
or text.

			regards, tom lane





[Index of Archives]     [Postgresql Home]     [Postgresql General]     [Postgresql Performance]     [Postgresql PHP]     [Postgresql Jobs]     [PHP Users]     [PHP Databases]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Forum]

  Powered by Linux