1
很短的问题。谁能说为什么这个查询PostgreSql。连接的奇怪行为
select LENGTH(' '::char || ' '::char), LENGTH(' '::text || ' '::char), LENGTH(' ' || ' '), LENGTH('a'::char || 'b'::char);
回报
0 1 2 2
是空间特殊字符巫不与其他字符串拼接?
文件说,只有这个:
Unless otherwise noted, all of the functions listed below work
on all of these types, but be wary of potential effects of
automatic space-padding when using the character type.
我为什么这样做呢?因为我在存储过程中通过char构建字符串char,并且当我试图用char连接varchar时没有任何反应。
因此,我改变了我的变量类型,包含从char(1)到varchar(1)的currient char,并且everythign都变好了。谢谢。 – Yavanosta