gpt4 book ai didi

postgresql - Postgres 安装失败, 'unexpected character ";"'

转载 作者:行者123 更新时间:2023-11-29 13:33:57 27 4
gpt4 key购买 nike

所以今天早上我无法从 Ubuntu 存储库安装 Postgres 9.1。我尝试从 postgres repo 安装 9.2,但如果失败并出现相同的错误。错误跟踪确实没有提供任何信息(我什至不知道这个错误的来源是什么)。 Google 也没有告诉我任何信息。

在安装过程中失败,同样的错误,我尝试手动创建集群。但是……

root@Ubuntu-1304-raring-64-minimal /home/tmp # pg_createcluster 9.2 main --start
Creating new cluster (configuration: /etc/postgresql/9.2/main, data: /var/lib/postgresql/9.2/main)...
FATAL: syntax error at line 5067: unexpected character ";"
child process exited with exit code 1
initdb: removing contents of data directory "/var/lib/postgresql/9.2/main"
Error: initdb failed

怎么了?

最佳答案

根据 dpkg -l 'postgres*' 的输出:

ii  postgresql-9.2                               9.2.4-1.pgdg12.4+1          amd64                       object-relational SQL database, version 9.2 serverun  postgresql-client                                                                              (no description available)ii  postgresql-client-9.1                        9.1.9-1ubuntu1              amd64                       front-end programs for PostgreSQL 9.1ii  postgresql-client-9.2                        9.2.4-1.pgdg12.4+1          amd64                       front-end programs for PostgreSQL 9.2ii  postgresql-client-common                     140                         all                         manager for multiple PostgreSQL client versionsii  postgresql-common                            140                         all              

postgresql-9.2 is already installed (see the ii flags in the leftmost column), as well as the client tools for 9.1 and 9.2 from a mix of pgdg and ubuntu repositories.

Anyway, the error encountered by pg_createcluster is quite unusual. From the output, especially the line number, it would seem that the underlying initdb fails when playing the postgres.bki file.

For 9.2, this file is: /usr/share/postgresql/9.2/postgres.bki. It contains low-level commands in a sql-like dialect to populate the cluster with pre-initialized data (template databases, pre-defined types and views, etc.)

It's hard to imagine that this file would be corrupted, especially since you have a similar problem when installing 9.1 that comes with a different postgres.bki file right from the package.

Still you may check just in case what's at line 5067 and around. In my build directory for 9.2.4, I have this:

insert OID = 1 ( template1 10 ENCODING "LC_COLLATE" "LC_CTYPE" t t -1 0 0 1663 _null_)

And there isn't a ; character anywhere in the entire file.

Other than that, you may want to remove the entire postgresql installation to restart from a clean base:

# purge client packages
dpkg --purge postgresql-client-9.1 postgresql-client-9.2 postgresql-client-common
# purge server packages
dpkg --purge postgresql-9.2 postgresql-common

关于postgresql - Postgres 安装失败, 'unexpected character ";"',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17713724/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com