5

I have setup a postgres database(version 9.1) and trying to create a table capable of storing st_geometry with the following query :

CREATE TABLE sensitive_areas (area_id integer, name varchar(128), zone st_geometry);

But I am getting the error as follows :

ERROR:  type "st_geometry" does not exist

Do I need to configure my postgres installation further to enable geometry data type .

2 Answers 2

11

The correct type name is geometry. If you are you are using PostGIS 2.0 you can use a typmod:

-- If you haven't done so already
CREATE EXTENSION postgis;

-- Make a table of Polygons, using long/lat coords
CREATE TABLE sensitive_areas (
    area_id integer primary key,
    name varchar(128),
    zone geometry(Polygon,4326)
);
Sign up to request clarification or add additional context in comments.

Comments

4
CREATE TABLE sensitive_areas (area_id integer, name varchar(128), zone geometry);

You should have PostGIS installed in you db for this to work.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.