[postgis-users] QGIS requires
William Furnass
will at thearete.co.uk
Mon Oct 11 04:52:34 PDT 2010
Hi,
Aman: did you test your suggestion? If you create a view from
(nextval('myseq') as id, geom, attr1, attr2) then QGIS will complain
that a layer cannot be created from that view as geom, attr1 and attr2
are not of suitable for use as a unique key (but does not even mention
the view field corresponding to the created sequence). Bah.
Unfortunately the majority of the views I'd like to be able to view in
QGIS are derived from queries involving aggregate functions such as
ST_Union so I don't think recreating my tables with OIDS will help.
Will
On 18 August 2010 19:05, Aman Verma <aman.verma at mcgill.ca> wrote:
>
> First, you have to create a 'sequence'. But you only have to do this once. It won't really matter if several different tables are using the same sequence in your situation.
>
> create sequence sq; -- You only have to do this once. You could also make a temporary sequence. create temporary...
>
> CREATE VIEW my_view AS (SELECT
> nextval('sq'), -- this is the function to access the next number from your sequence.
> St_Union(wkb_geometry) FROM my_subregions GROUP BY region_id);
>
>
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of William Furnass
> Sent: August 18, 2010 1:52 PM
> To: PostGIS Users Discussion
> Subject: [postgis-users] QGIS requires
>
> QGIS requires that all PostGIS tables/views have a numeric primary
> key. As a result I have had to create many temporary tables solely
> for the purpose of viewing the results of queries when ideally I would
> have liked to create views from the majority of my queries. Does
> anyone know if I can create on-the-fly a serial numeric column in
> queries/views to save me having to create so many temporary tables?
> It'd be grand if something like the following were possible:
>
> CREATE VIEW my_view AS (SELECT numeric_id_generator(),
> St_Union(wkb_geometry) FROM my_subregions GROUP BY region_id);
More information about the postgis-users
mailing list