在 postgresql 中,如何在字符中保留空格

问题描述

如何在char中保留空格? 我创建了 2 个表,

create table test_1 (a int,b char(10)) ;
create table test_2 (a int,b varchar(255));

并在 test_1 中插入一行

insert into test_1 values (1,'     ');


insert into test_2 select * from test_1;
select a,length(b) from test_2;

然后它返回

| a        | length(b)      |
| -------- | -------------- |
| 1        | 0              |

我期待 bleow,就像 oracle 一样

| a        | length(b)      |
| -------- | -------------- |
| 1        | 10             |

有什么办法可以试试吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)