重庆思庄Oracle、KingBase、PostgreSQL、Redhat认证学习论坛
标题: PG标识符长度不能超过63个字符 [打印本页]
作者: 郑全 时间: 2025-8-8 10:43
标题: PG标识符长度不能超过63个字符
如果超过,会截断。
比如我们创建一个超过63个字符的表名如下:
create table a1234567890abcdefghigklmnopqrstuvwzyz1234567890abcdefghijklmnopqrstuvwxyz(a int)
postgres-# ;
NOTICE: identifier "a1234567890abcdefghigklmnopqrstuvwzyz1234567890abcdefghijklmnopqrstuvwxyz" will be truncated to "a1234567890abcdefghigklmnopqrstuvwzyz1234567890abcdefghijklmnop"
CREATE TABLE
postgres=# \d
List of relations
Schema | Name | Type | Owner
--------+-----------------------------------------------------------------+-------+-------
public | a1234567890abcdefghigklmnopqrstuvwzyz1234567890abcdefghijklmnop | table | pg16
public | emp | table | pg16
(2 rows)
看一下长度:
postgres=# select length(relname) from pg_class where relname='a1234567890abcdefghigklmnopqrstuvwzyz1234567890abcdefghijklmnop';
length
--------
63
(1 row)
只有63个字符。
作者: 郑全 时间: 2025-8-8 10:49
当然,这个长度限制可以修改源码进行调整。具体位置:
src/include/pg_config_manual.h文件中