我是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后遇到了同样的问题.
原文链接:https://www.f2er.com/postgresql/191670.html问题似乎是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禁用了该优化,问题就消失了.