Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I've got a PostGIS databases, with lots of schemas. I can easily create a new user that will allow them to update and delete features. However when I get the user to create a new feature I get the following error in QGIS:-

  PostGIS error while adding features: ERROR:  new row for relation "conservation_areas" violates check constraint "enforce_geotype_geom

I've used the following SQL to GRANT the user (anne) privilages that will allow her to update and delete, but I guess its the insert bit that is letting me down.

GRANT ALL ON SCHEMA conservation TO anne;
GRANT SELECT ON ALL TABLES IN SCHEMA conservation TO anne;
GRANT UPDATE ON conservation.conservation_areas_gid_seq To anne;
GRANT UPDATE ON conservation.conservation_areas TO anne;

The postgres user has no such issues when edited data, therefore I'm missing something somewhere when i'm granting the user permissions. Is there a simple SQL that will allow a user to do everything that the Postgres user can do but to a specific tables (and not all tables) within a schema?

Med

share|improve this question
    
login as superuser - GRANT ALL PRIVILEGES ON conservation TO anne; –  Mapperz Aug 10 '12 at 14:24
1  
can you post the definition of the constraint that throws the error? –  underdark Aug 10 '12 at 14:29
    
Won't GRANT ALL PRIVILEGES mean that the user will be able to edit all tables in the conservation schema? –  geosmiles Aug 10 '12 at 16:40
    
underdark - I'm not at my work PC anymore so don't have access to my database. Where would I find the 'definition of the constraint that throws the error" to post here? –  geosmiles Aug 10 '12 at 18:30

2 Answers 2

That error message has nothing to do with privileges. Your new feature violates a CHECK constraint on the table. Based upon what is left of the constraint name, it looks like the new feature being added is not of the correct geometry type (POINT, LINESTRING, POLYGON, etc.).

share|improve this answer
    
As I hinted at in my first post, if I log into my postgis in QGIS using my postgres login, I can edit (update, insert and deleted) features from the same table which is a polygon dataset without any issues. –  geosmiles Aug 10 '12 at 18:30
up vote 1 down vote accepted

With a slight tweak to Mapperz suggested SQL statement, the below SQL allows my user (anne) in QGIS to save a new map feature to my table.

GRANT ALL ON SCHEMA conservation TO anne;
GRANT SELECT ON ALL TABLES IN SCHEMA conservation TO anne;
GRANT ALL PRIVILEGES ON conservation.conservation_areas TO anne;
GRANT UPDATE ON conservation.conservation_areas_gid_seq TO anne;

Thanks all for your posts.

Med

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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