【问题标题】:Why char datatype is converted to bpchar automatically?为什么 char 数据类型会自动转换为 bpchar?
【发布时间】:2018-07-19 11:16:01
【问题描述】:

是否有可能将CHAR 数据类型自动转换为bpchar

我们已经看到从应用程序端选择列datatypeCHAR 但数据库级别bpchar 已创建的场景。

谁能帮我解决这个问题?

【问题讨论】:

标签: postgresql postgresql-9.3


【解决方案1】:

https://www.postgresql.org/docs/current/static/datatype-character.html

character(n), char(n) 定长,空白填充

实际上在 bpchar 中 b 代表空白,p 代表填充,bpcharchar(n)character(n) 相同,空白填充到 @987654326 @长度字符串...

更多报价:

https://www.postgresql.org/docs/current/static/typeconv-query.html

bpchar(“空白字符”,字符数据的内部名称 类型)

【讨论】:

  • 感谢您的回复,这两者有什么区别吗?否则两者都相同
  • @Ram 没有区别。如果你想要不同的字符,那么你可能想看看“char”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.
猜你喜欢
  • 1970-01-01
  • 2013-04-02
  • 1970-01-01
  • 1970-01-01
  • 2011-11-20
  • 2017-05-30
  • 2022-01-10
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多