[Qgis-user] QGIS 2.10.1 adding PostGIS Views

Bernhard Ströbl bernhard.stroebl at jena.de
Thu Sep 3 23:49:08 PDT 2015


Hi Andrea,

by reading out pg_constraint [1]
if a UNIQUE constraint is defined the uniqueness is guaranteed by the 
db, no need for QGIS to also check it.

Bernhard

[1] 
http://www.postgresql.org/docs/9.4/interactive/catalog-pg-constraint.html

Am 04.09.2015 um 08:42 schrieb Andrea Peri:
> Ho,
> How do qgis to analyze the table to retrieve the unique?
> A loop on every record or a SQL to count distinct ?
>
> A.
>
> Il 04/set/2015 08:01, "Bernhard Ströbl" <bernhard.stroebl at jena.de
> <mailto:bernhard.stroebl at jena.de>> ha scritto:
>
>
>
>     Am 03.09.2015 um 23:41 schrieb Sandro Santilli:
>
>         On Wed, Sep 02, 2015 at 08:48:34AM +0200, Bernhard Ströbl wrote:
>
>             Am 01.09.2015 um 17:49 schrieb Matthias Kuhn:
>
>
>
>                 2. If there are tables without a PK open a second modal
>                 dialog with an
>                 explanation of the problem and offer to select a pk from
>                 a combobox.
>
>
>             I hope you mean "relation" not table, a table should always
>             have a
>             PK.
>
>
>         It's not mandatory for a table to have a PK.
>         I guess by "tables without a PK" he means table for which no PRIMARY
>         KEY constraint is explicitly defined (should an UNIQUE key be
>         considered equally valid?).
>
>
>     It is not mandatory, of course, that's why I wrote "should", but
>     IMHO it is very bad database design to not define one.
>     There might be several UNIQUE constraints on one table but there can
>     be only one PK constraint. So in case of only a UINIQUE constraint
>     the table would be handled as any other without PK constraint (or
>     QGIS needs to analyse how many fields have a UNIQUE constraint).
>
>     Bernhard
>
>
>     __________ Information from ESET Mail Security, version of virus
>     signature database 12200 (20150904) __________
>
>     The message was checked by ESET Mail Security.
>     http://www.eset.com
>
>
>     _______________________________________________
>     Qgis-user mailing list
>     Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>
>     http://lists.osgeo.org/mailman/listinfo/qgis-user
>



__________ Information from ESET Mail Security, version of virus signature database 12200 (20150904) __________

The message was checked by ESET Mail Security.
http://www.eset.com





More information about the Qgis-user mailing list