initdb:初始化pg_authid ... FATAL:错误数目的索引表达式 [英] initdb: initializing pg_authid ... FATAL: wrong number of index expressions

查看:366
本文介绍了initdb:初始化pg_authid ... FATAL:错误数目的索引表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是PostgreSql的新手。我正在尝试在系统中安装PostgreSql。我的操作系统是Ubuntu,以下是我的错误



数据库集群将使用语言环境en_US.UTF-8初始化。
相应地,默认的数据库编码已设置为UTF8。

 创建目录p01 / pgsql / data ...确定
创建子目录...确定
选择默认的max_connections ... 100
选择默认shared_buffers / max_fsm_pages ... 24MB / 153600
创建配置文件...确定
在p01 / pgsql / data / base / 1中创建template1数据库... ok
初始化pg_authid ...致命:错误的索引表达式数量
语句:创建触发器pg_sync_pg_database后插入或更新或删除

pg_database用于每个语句执行程序flatfile_update_trigger();

子进程已退出,退出代码为1
initdb:删除数据目录 p01 / pgsql / data

帮帮我!!
谢谢!

解决方案

在用gcc 4.9.3编译postgresql 8.1.4之后,我遇到了同样的问题。 / p>

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

  typedef struct 
{
int32 size; / *这些字段必须匹配ArrayType! * /
int ndim;
个int标志;
Oid元素类型;
int dim1;
int lbound1;
int2值[1]; / *可变长度数组* /
} int2vector; / *可变长度结构* /

在某些情况下,对于循环访问值,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禁用了优化功能,问题消失了。


I'm new to PostgreSql.I'm trying to install PostgreSql in my system.My operating System is Ubuntu,Below posted is my error

The database cluster will be initialized with locale en_US.UTF-8. The default database encoding has accordingly been set to 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"

Help me out!! Thanks!

解决方案

I ran into the same problem after compiling postgresql 8.1.4 with gcc 4.9.3.

The problem seems to be the way postgres uses to represent variable length arrays:

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 */

In some cases, for loops accessing 'values', GCC assumes that they will do one iteration at most. Loops like the one below (extracted from postgres's source code):

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

might end up being reduced to something like:

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

as deduced by looking at the assembler generated for it:

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

The problem went away after re-compiling postgres with that optimization disabled by using -fno-aggressive-loop-optimizations.

这篇关于initdb:初始化pg_authid ... FATAL:错误数目的索引表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆