[postgis-users] unique id in QGIS/PostGIS

Richard Greenwood richard.greenwood at gmail.com
Sat Apr 6 06:28:10 PDT 2013


On Sat, Apr 6, 2013 at 2:18 AM, Margie Roswell <mroswell at gmail.com> wrote:

> I've been googling up a storm, now that I've got a local postgis database
> with QGIS. But still haven't figured out how to display a newly created
> table.
>
> The query I used to create the table:
> CREATE TABLE smaller_leg_final AS
> SELECT ST_Buffer(geom,-500) AS geom, legislative_final.district
> FROM legislative_final
> WHERE area > 30;
>
> I then discovered that I needed a unique ID, and did the following:
> ALTER TABLE smaller_leg_final ADD COLUMN id serial not null;
>


Why don't you try making you unique column a primary key?

ALTER TABLE smaller_leg_final
  ADD CONSTRAINT smaller_leg_final_pk PRIMARY KEY(id);

Rich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130406/6be6a245/attachment.html>


More information about the postgis-users mailing list