GIVEN: gisTable (Table) has a geom (geometry) column defined as follows:

    ALTER table gisTable ADD column geom geometry (Multipolygon, 4326);

I am attempting to run the UPDATE command below which is part of a function I am attempting to debug. The UPDATE command is as follows. my function not shown takes 7 arguments from a vb application (the table name, a primary id , an alternate id and two coordinate pairs (lon/lat) which form the GIS polygon to be inserted.

    UPDATE thisSchema.gisTable SET geom=st_asbinary(st_geomfromtext('POLYGON((37.98 7.51, 38.51 7.51, 38.51 6.98, 37.98 6.98, 37.98 7.51))', 4326)) WHERE mainid = '023456' AND altId = 'ABC';

When I execute the command above the error states that the SRID is not found or is SRID(0); however I am setting it in the st_geomfromtext portion of this clause.

Questions: Can I use POLYGON even though the geom column was defined as Multipolygon (above) When I modify POLYGON to MULTIPOLYGON I get a parse error after the first coordinate.

Should the POLYGON clause be wrapped in two (( and )) as shown above.

I have the following function I am using to update each row in gis_table' geom column;


2 Answers 2


No you can not use polygon if the column is defined as multipolygons. For update you could use this command.

  UPDATE gisTable 
  SET geom=
  st_multi((st_geomfromtext('POLYGON((37.98 7.51, 38.51 7.51, 38.51 6.98, 37.98 6.98, 37.98 7.51))', 4326))) ;

I mad the following modification and successfully UPDATED the geom column

    UPDATE thisSchema.gisTable SET geom=st_geomfromtext('MULTIPOLYGON(((37.98 7.51, 38.51 7.51, 38.51 6.98, 37.98 6.98, 37.98 7.51)))', 4326) WHERE mainid = '023456' AND altId  = 'ABC';

The MULTIPOLY clause needs ((( and ))) and st_asbinary was not needed. Any other thoughts???

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.