Thread: some info about char(1)

some info about char(1)

From
"And. Andruikhanov"
Date:
Good day.

It's some differences in results, then I inserted char(1) type:

create table ku(n_pp int4, col char(1));

insert into ku values(1, '\000');
insert into ku values(2, '\040');
insert into ku values(3, ichar(0));
insert into ku values(4, ichar(32));

select n_pp, ascii(col) from ku ;
 n_pp | ascii
------+-------
    1 |    32
    2 |    32
    3 |     0
    4 |    32
(4 rows)

Look at the strings where n_pp equal 1 and 2. "Col" column always equals to 32
(decimal), but I inserted as '\000' and '\040'.
  If I use ichar() function, then "col" column has another values.
Is it right ?
  Locales for "postgres" user adjust properly (if it's necessary).
  Postgresql version: 7.0.2 on FreeBSD 4.2-stable.

ps. I use some function from list, which generated by "\df" command from psql
console. But I didn't found them in pgsql documentation. Is it possible that
this function will be removed in future version of postgresql ?
pps. Can I take description of this function ?
  sorry for my bad english ;)


  Regards..
--

Re: some info about char(1)

From
Karel Zak
Date:
> console. But I didn't found them in pgsql documentation. Is it possible that
> this function will be removed in future version of postgresql ?
> pps. Can I take description of this function ?

 As said Tom, ichar() is chr() in 7.1.

Lates (devel) docs:

http://www.postgresql.org/devel-corner/docs/user/functions-string.htm


 chr(integer) text Returns the character with the given ASCII code.

        Karel