[postgis-users] unique id in QGIS/PostGIS
Paolo Corti
pcorti at gmail.com
Sat Apr 6 02:03:10 PDT 2013
On Sat, Apr 6, 2013 at 10:18 AM, Margie Roswell <mroswell at gmail.com> wrote:
>
> 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;
>
> This successfully populated the ID field with unique integers.
>
> However when I go into QGIS, the Primary Key column offers no options. when
> I click into it, it just asks me to choose an SRID, which I believe I've
> already done. The table loads, but nothing displays.
>
Which version of PostGIS are you using?
Could you send the DDL CREATE TABLE syntax?
You can get it like this:
pg_dump -t tablename --schema-only
or copy and paste it from the pgAdmin SQL table pane
I have the suspect, thought, that you are using PostGIS < 2.0: in that
case you explicitely need to record the metadata in geometry_columns
using AddGeometryColumn
regards
p
--
Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @capooti
skype: capooti
More information about the postgis-users
mailing list