char column with a single space as the default not working

Поиск
Список
Период
Сортировка
От Sbob
Тема char column with a single space as the default not working
Дата
Msg-id f7b61d30-3b95-463a-9627-fed806e5e2db@quadratum-braccas.com
обсуждение исходный текст
Ответы Re: char column with a single space as the default not working  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: char column with a single space as the default not working  (Peter Gram <peter.m.gram@gmail.com>)
Список pgsql-admin
All;


I created a table like this:

create table z (charcol char(1) default  ' ', intcol int);


Then I inserted a row with a single space in the charcol column and 
another insert letting the table use the default value:

insert into z values (' ', 1);

insert into z (intcol) values (2);


However neither of the inserted rows actually retained the single space 
in the charcol column:


select '[' || charcol || ']', intcol from z;
  ?column? | intcol
----------+--------
  []       |      1
  []       |      2
(2 rows)


Thoughts? Is it possible to add a single space to a char column without 
it getting truncated?


Thanks in advance




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

Предыдущее
От: John Scalia
Дата:
Сообщение: Logical replication issue, pg 13.9
Следующее
От: ROHIT SACHDEVA
Дата:
Сообщение: Re: Related to Foreign Table Accessing