首页 > 解决方案 > 读取表时,出现错误:无法访问文件“$libdir/postgis-2.3”:没有这样的文件或目录

问题描述

我通过 GCP 在 Google CLoud SQL 中为我在 PC 和 App 中的应用程序创建了一个名为“datastore”的 PostgreSQL 数据库。云中 Postgre 服务器的版本是 9.6。我使用 Windows 的“psql”客户端和 Python Postgre 库“psycopg2”与该数据库通信以读取存储的表。我使用以下命令使用“psql”客户端进行通信:

PS D:\> psql -h <Db-IP-Address> -U postgres

其中“Db-IP-Address”是 GCP 分配给“datastore”的 IP 地址。以下是“数据存储区”中的一些表:

postgres=> \dt
               List of relations
 Schema |            Name            | Type  |  Owner
--------+----------------------------+-------+----------
 public | company                    | table | postgres
 public | django_admin_log           | table | postgres
 public | django_content_type        | table | postgres
 public | django_migrations          | table | postgres
 public | image_data                 | table | postgres
 public | imagedata                  | table | postgres
 public | maggi                      | table | postgres
 public | storelocation2             | table | postgres

直到昨天,在读/写表格时一切正常。但是昨天突然尝试读取/编辑表'storelocation2'。它给出以下错误:

postgres=> \d storelocation2        
ERROR:  could not access file "$libdir/postgis-2.3": No such file or directory
postgres=>

在“选择”命令中也会发生同样的情况:

postgres=> SELECT * FROM storelocation2;
ERROR:  could not access file "$libdir/postgis-2.3": No such file or directory
postgres=>

虽然读取任何其他表格时不会出现此类错误。该'storelocation2'表包含存储详细信息的数据,例如名称、位置等,变量定义为'VARCHAR',一个“地理”点定义为'geography(POINT, 4326)'

请任何人都可以提出可能的原因和任何补救措施以使桌子恢复原状。因为它可能导致大量数据丢失!

标签: postgresql-9.6

解决方案


推荐阅读