加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

postgresql – initdb:初始化pg_authid …致命:索引表达式数量

发布时间:2020-12-13 16:31:30 所属栏目:百科 来源:网络整理
导读:我是PostgreSql的新手.我正在尝试在我的系统中安装PostgreSql.我的操作系统是Ubuntu,下面发布的是我的错误 将使用区域设置en_US.UTF-8初始化数据库群集. 因此,默认数据库编码已设置为UTF8. creating directory p01/pgsql/data ... okcreating subdirectories
我是PostgreSql的新手.我正在尝试在我的系统中安装PostgreSql.我的操作系统是Ubuntu,下面发布的是我的错误

将使用区域设置en_US.UTF-8初始化数据库群集.
因此,默认数据库编码已设置为UTF8.

creating directory p01/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers/max_fsm_pages ... 24MB/153600
creating configuration files ... ok
creating template1 database in p01/pgsql/data/base/1 ... ok
initializing pg_authid ... FATAL:  wrong number of index expressions
STATEMENT:  CREATE TRIGGER pg_sync_pg_database   AFTER INSERT OR UPDATE OR DELETE ON   

pg_database   FOR EACH STATEMENT EXECUTE PROCEDURE flatfile_update_trigger();

child process exited with exit code 1
initdb: removing data directory "p01/pgsql/data"

帮帮我!!
谢谢!

用gcc 4.9.3编译postgresql 8.1.4后遇到了同样的问题.

问题似乎是postgres用来表示可变长度数组的方式:

typedef struct
{
    int32       size;           /* these fields must match ArrayType! */
    int         ndim;
    int         flags;
    Oid         elemtype;
    int         dim1;
    int         lbound1;
    int2        values[1];      /* VARIABLE LENGTH ARRAY */
} int2vector;                   /* VARIABLE LENGTH STRUCT */

在某些情况下,对于访问“值”的循环,GCC假定它们最多只进行一次迭代.循环如下(从postgres的源代码中提取):

ii->ii_NumIndexAttrs = numKeys;
for (i = 0; i < numKeys; i++)
    ii->ii_KeyAttrNumbers[i] = indexStruct->indkey.values[i];

可能最终被缩减为:

ii->ii_NumIndexAttrs = numKeys;
if (numKeys)
    ii->ii_KeyAttrNumbers[0] = indexStruct->indkey.values[0];

通过查看为其生成的汇编程序推断:

.L161:
    testl   %r12d,%r12d
    movl    %r12d,4(%rbx)
    jle .L162
    movzwl  40(%r13),%eax
    movw    %ax,8(%rbx)
.L162:

重新编译postgres后,通过使用-fno-aggressive-loop-optimizations禁用了该优化,问题就消失了.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读