shp2pgsql创建一个表,但psql报告“关系...不存在”

时间:2013-11-18 18:10:58

标签: 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
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;

3 个答案:

答案 0 :(得分:1)

使用全小写表名修复了问题。使用us_counties作为表名。

答案 1 :(得分:0)

使用大写表名称时可以使用双引号。

   select * from "County_2010Census_DP1";

答案 2 :(得分:0)

您可能需要使用以下代码向数据库添加postgis扩展名:

$('.form-image1')