【发布时间】:2018-07-19 11:16:01
【问题描述】:
是否有可能将CHAR 数据类型自动转换为bpchar?
我们已经看到从应用程序端选择列datatype 是CHAR 但数据库级别bpchar 已创建的场景。
谁能帮我解决这个问题?
【问题讨论】:
-
什么应用程序?你是如何选择数据类型的?给我们看一些代码。
是否有可能将CHAR 数据类型自动转换为bpchar?
我们已经看到从应用程序端选择列datatype 是CHAR 但数据库级别bpchar 已创建的场景。
谁能帮我解决这个问题?
【问题讨论】:
https://www.postgresql.org/docs/current/static/datatype-character.html
character(n), char(n) 定长,空白填充
实际上在 bpchar 中 b 代表空白,p 代表填充,bpchar 与 char(n) 或 character(n) 相同,空白填充到 @987654326 @长度字符串...
更多报价:
https://www.postgresql.org/docs/current/static/typeconv-query.html
bpchar(“空白字符”,字符数据的内部名称 类型)
【讨论】:
The type "char" (note the quotes) is different from char(1) in that it only uses one byte of storage. It is internally used in the system catalogs as a simplistic enumeration type.