[Qgis-user] QGIS 2.10.1 adding PostGIS Views
Andrea Peri
aperi2007 at gmail.com
Fri Sep 4 01:18:31 PDT 2015
Hi,
I guess could be two kind of approaches alternative to the actual.
The first is to allow a standard access to a view only readonly .
Avoiding so the need for a pk field.
For who need a view writable in qgis. The approach could be to allow
in the properties of the layer in the field section to set the type PK
in the list of fields of the view.
I guess this is acceptable because s similar to the usage of it for
defining alias or hide fields from the view.
The second approach is to ask to the user when add a layer that is a
view if need editable or not. If the user ask for an add layer (view)
editable .
(Otherwise start this analysys the first time the user check the
editing button).
As kind of analysy I guess the best approach could be to do
a kind of:
select count(distinct (field1, field2)) from view;
To avoid to check for every field of the view.
A first reduction could be done using the field from tables where
there is an alphanumeric index defined (don't matter unique).
I complex step could be to link the field of the view to the field of a table.
I guess this link is not provided directly from postgres.
A.
2015-09-04 8:51 GMT+02:00 Jürgen E. <jef at norbit.de>:
> Hi Andrea,
>
> On Fri, 04. Sep 2015 at 08:42:31 +0200, Andrea Peri wrote:
>> How do qgis to analyze the table to retrieve the unique?
>> A loop on every record or a SQL to count distinct ?
>
> For vies probably yes. And if that doesn't help, any combination of fields (up
> to all fields). And then hope that the very expensively found "key constraint"
> is not ruined by data added later.
>
> But actual constraints can be retrieved from the database.
>
>
> Jürgen
>
> --
> Jürgen E. Fischer norBIT GmbH Tel. +49-4931-918175-31
> Dipl.-Inf. (FH) Rheinstraße 13 Fax. +49-4931-918175-50
> Software Engineer D-26506 Norden http://www.norbit.de
> QGIS release manager (PSC) Germany IRC: jef on FreeNode
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
--
-----------------
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-----------------
More information about the Qgis-user
mailing list