When trying to save a style to postgis database through QGIS I am getting the error:

'Unable to save layer style. It's not possible to insert a new record into the style table. Maybe this is due to table permissions (user=admin_gis). Please contact your database administrator.

After reading other posts, I have found there is no layer_styles in the public schema. I have tried adding this table in manually and re-saving but still receiving the same error.

I cant seem to find a resolution that works for me online, has anyone else had/solved this problem?enter image description here

  • Is public part of admin_gis search path? (connect to Postgres as admin_gis and type SHOW search_path; ) – JGH Jan 10 '18 at 12:03
  • Yes I get the output: "$user",public – Alice Palmer Jan 10 '18 at 12:11

Solved using different syntax:

CREATE TABLE layer_styles(
,f_table_catalog varchar
,f_table_schema varchar
,f_table_name varchar
,f_geometry_column varchar
,styleName varchar(30)
,styleQML xml
,styleSLD xml
,useAsDefault boolean
,description text
,owner varchar(30)
,ui xml
,update_time timestamp DEFAULT CURRENT_TIMESTAMP

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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