[postgis-users] AddGeometryColumn => column does not exist

Owen Jacobson ojacobson at osl.com
Fri Nov 18 16:57:20 PST 2005


John Taber wrote:
 
> I've done a fresh install of 8.1 postgres/postgis.  I've done 
> the following:
...
> # CREATE TABLE gtest(ID int4, NAME varchar(20));
> CREATE TABLE
> # SELECT AddGeometryColumn("gtest","roads_geom",-1,"GEOMETRY",3);
> ERROR: column "gtest" does not exist
> 
> 1) The tutorial and manual 4.2.3 use single quotes - my 
> system chokes on 
> that with quoted fields shown as unknown and the function 
> doesn't match.
> 
> 2) I've tried both syntax shown in 4.2.3 (with and without 
> schema name) 
> and still get the column does not exist error. If the schema 
> is put in 
> as null ("") the system chokes with ERROR: zero length 
> delimited... If 
> put in as space (" ") then the column does not exist error appears.
> 
> What is wrong here ?

Double-quotes in an SQL query mark a field literal, not a string.  AddGeometryColumn takes strings (varchar, IIRC), not field literals.

Try:

# SELECT AddGeometryColumn ('gtest'::VARCHAR, 'roads_geom'::VARCHAR, -1, 'GEOMETRY'::VARCHAR, 3);

This shouldn't be necessary but I haven't used postGIS with postgresql 8.1 yet.

-Owen



More information about the postgis-users mailing list