[Geoserver-users] PostgreSQL 8, GeoServer and OIDs

Here's the easiest way to fix this on your dataset:

-- add a unique key to the table
alter table <tablename> add column fid serial;

If you look at your table, you'll see you have a "fid" column
pre-populated for you with unique values!

I believe geotools will auto-detect this and use it as the FID. If it
doesn't you can force it with:

alter table <tablename> add primary key (fid);

dave

----------------------------------------------------------
This mail sent through IMP: https://webmail.limegroup.com/

On Mar 3, 2006, at 2:28 PM, dblasby@anonymised.com wrote:

Here's the easiest way to fix this on your dataset:

-- add a unique key to the table
alter table <tablename> add column fid serial;

If you look at your table, you'll see you have a "fid" column
pre-populated for you with unique values!

I believe geotools will auto-detect this and use it as the FID. If it
doesn't you can force it with:

alter table <tablename> add primary key (fid);

Thanks Dave (and Chris).

It seems OGR does create a unique or at least auto-incremented id column: ogc_fid. It just doesn't make it a primary key.

I simply altered that column to be a primary key:

  ALTER TABLE tablename ADD CONSTRAINT ogc_fid_pkey PRIMARY KEY (ogc_fid);

Now, I'm getting results.

  Sean

Richard Sean Fulton wrote:

On Mar 3, 2006, at 2:28 PM, dblasby@anonymised.com wrote:

Here's the easiest way to fix this on your dataset:

-- add a unique key to the table
alter table <tablename> add column fid serial;

If you look at your table, you'll see you have a "fid" column
pre-populated for you with unique values!

I believe geotools will auto-detect this and use it as the FID. If it
doesn't you can force it with:

alter table <tablename> add primary key (fid);

Thanks Dave (and Chris).

It seems OGR does create a unique or at least auto-incremented id column: ogc_fid. It just doesn't make it a primary key.

I simply altered that column to be a primary key:

    ALTER TABLE tablename ADD CONSTRAINT ogc_fid_pkey PRIMARY KEY (ogc_fid);

Now, I'm getting results.

Awesome, thanks for the feedback, I just added this information to the PostGIS Datastore wiki page.

    Sean

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Chris Holmes
The Open Planning Project
thoughts at: http://cholmes.wordpress.com