[Qgis-developer] Postgis layer_styles table

Luigi Pirelli luipir at gmail.com
Wed Jan 11 01:22:23 PST 2017


On 11 January 2017 at 00:49, Jorge Gustavo Rocha <jgr at di.uminho.pt> wrote:
> i) The current DDL is (as defined in [1]):
>
> CREATE TABLE layer_styles(
>  id SERIAL PRIMARY KEY
>  ,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
> )
>
> On Postgresql, both the username and column names can have 63 characters
> [3].
>
> a) There is an old feature request [2] to enlarge the owner column name (it
> only has 30 characters right now).

I don't this there would be drawback... would make sense to align the
struct for all a¡other providers with save style capabilities?

> b) Sometimes I use the same name for the table and for the style. It makes
> sense to allow the styleName as long as the table name can be.
>
> My proposal is to change both owner and styleName columns to 63 characters.

no problem IMHO

> So, my first point is: does anyone knows/remembers why these fields were
> defined with 30 characters? Are there any arguments against changing the
> maximum length to 63?

no idea... we should contact Emilio Loi the author of the commit
41f7418fe22ab31b994397eaa8621c1e6891dd34

> ii) I found no way to delete an exiting style from QGIS interface. Styles
> can be added or changed, but not deleted.

good Idea, please add deleteStyle as capability and and/or implement
in th othr providers

> Which would be the best approach to allow users to remove an existing style?
>
> I can allow the removal by adding a small button to the "load style from
> database" dialogue [4]. The user selects a style and the remove button
> becomes available to remove it. It is not a perfect solution, but it is easy
> to implement.

renaming "load style from DB" widged as Saved styles manager can solve
+ adding delete butt as you suggest

>
> iii) When writing or updating styles, the error management is very simple. I
> would like to provide further information to the user when the user is not
> able to insert, update (or delete) the style. Right now, a generic message
> is presented, that says:
> "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=%1). Please
> contact your database administrator."

+1

> Regards,
>
> J. Gustavo

cheers

Luigi Pirelli

**************************************************************************************************
* Boundless QGIS Support/Development: lpirelli AT boundlessgeo DOT com
* LinkedIn: https://www.linkedin.com/in/luigipirelli
* Stackexchange: http://gis.stackexchange.com/users/19667/luigi-pirelli
* GitHub: https://github.com/luipir
* Mastering QGIS 2nd Edition:
* https://www.packtpub.com/big-data-and-business-intelligence/mastering-qgis-second-edition
**************************************************************************************************


More information about the Qgis-developer mailing list