Search code examples
sqlpostgresqlpostgis

Getting error while tryng to add geometry (polygon z) to table


I'm trying to insert a row to postgres (postgis) table and getting error.

My table (geo_table) properties:

id serial PRIMARY_KEY,
name text,
geometry geometry,
in_use boolean,
related text

I'm trying to add data:

INSERT into geo_table (name, geometry, in_use) VALUES ('tb2', POLYGON Z ((SOME NUMBERS)), FALSE);

I'm getting the following error:

syntax error at or near "Z" ...(name, geometry, in_use) VALUES ('tb2', POLYGON Z ((

what is the error ? and how can I add data ?


Solution

  • Try to include between single quotes ', it should work.

    INSERT into geo_table (name, geometry, in_use) 
    VALUES ('tb2', 'POLYGON Z (SOME NUMBERS)', FALSE);