I am creating a TABLE with the following sql:
-- Table: buildings
-- DROP TABLE buildings;
CREATE TABLE buildings
(
osm_id integer NOT NULL,
"name" character varying(255),
"type" character varying(255),
"geometry" geometry,
CONSTRAINT enforce_dims_geometry CHECK (st_ndims(geometry) = 2)
)
WITH (
OIDS=FALSE
);
ALTER TABLE buildings OWNER TO "user";
And Afterwards, trying to fill the table with data from another table with this:
SELECT osm_id, way
INTO buildings
FROM planet_osm_polygon
WHERE building='yes'
And I get the following error:
ERROR: relation "buildings" already exists
*** Error ***
ERROR: relation "buildings" already exists SQL state: 42P07
Any idea as to why this might be the case? I'm new to pgrouting and trying to figure out how to proceed.
Thanks!
Your command
SELECT osm_id, way
INTO buildings
FROM planet_osm_polygon
WHERE building='yes'
is creating table buildings which has been already created, that's why your getting this error. Please refer this link for more information