Postgresql shp2pgsql创建一个表,但psql报告;“关系……不存在”;
使用shp2pgsql将shapefile导入PostGIS数据库,所有操作都正常:Postgresql shp2pgsql创建一个表,但psql报告;“关系……不存在”;,postgresql,postgis,Postgresql,Postgis,使用shp2pgsql将shapefile导入PostGIS数据库,所有操作都正常: Connection: host=localhost port=5432 user=aperrin dbname=tweets password='******' Destination: public.County_2010Census_DP1 Source File: /home/aperrin/Downloads/County_2010Census_DP1/County_2010Census_DP1 S
Connection: host=localhost port=5432 user=aperrin dbname=tweets password='******'
Destination: public.County_2010Census_DP1
Source File: /home/aperrin/Downloads/County_2010Census_DP1/County_2010Census_DP1
Shapefile type: Polygon
Postgis type: MULTIPOLYGON[2]
Importing shapefile (3221 records)...
Creating spatial index...
Shapefile import completed.
在psql中,\d显示:
List of relations
Schema | Name | Type | Owner
--------+-----------------------------------------+----------+----------
public | County_2010Census_DP1 | table | aperrin
public | County_2010Census_DP1_gid_seq | sequence | aperrin
然而:
tweets=> \d County_2010Census_DP1
Did not find any relation named "County_2010Census_DP1".
tweets=> select * from County_2010Census_DP1;
ERROR: relation "county_2010census_dp1" does not exist
LINE 1: select * from County_2010Census_DP1;
使用全小写的表名修复了这个问题。使用us_countries作为表名。使用全小写表名修复了该问题。使用us_counties作为表名。使用大写表名时,可以使用双引号
select * from "County_2010Census_DP1";
使用大写表格名称时,可以使用双引号
select * from "County_2010Census_DP1";
您可能需要使用以下代码将postgis扩展添加到数据库:
psql -U username -d databasename
CREATE EXTENSION postgis;
您可能需要使用以下代码将postgis扩展添加到数据库:
psql -U username -d databasename
CREATE EXTENSION postgis;