[Geoserver-devel] [jira] Created: (GEOS-601) postgis tables no longer can rely on having OIDs

postgis tables no longer can rely on having OIDs
------------------------------------------------

         Key: GEOS-601
         URL: http://jira.codehaus.org/browse/GEOS-601
     Project: GeoServer
        Type: Bug

    Reporter: dblasby
Assigned to: Justin Deoliveira
     Fix For: 1.3.1

The most recent versions of postgresql no longer put the "oid" column in a table by default.

The postgis datastore makes the assumption that the oid field is there. It should be more vocal about whats happening (ie. send back a good error message in the ServiceException) and how to fix it.

Since we cannot rely on oids as the "default" FID generation, we should do a bit more testing of the SERIAL column FID generation (I dont think it get much use). I'm willing to help by moving the CITE test suite to a bunch of tables with SERIALs in them - that should be a good test.

There is a "primary key" FID generation which is pretty bogus, so I dont recommend using it for writing (because its not good at making "new" primary keys). Unfortunately, its the only thing you can use if you dont want to actually modify you table.

So, if you get the "oid" field not there error (you dont actually get this error (see below) - you get a "sql error"). You can either;
a. ALTER TABLE ... ADD COLUMN myFidColumn SERIAL;
b. ALTER TABLE ... ADD PRIMARY KEY ( <columns>); --- dont use for writing!!

You can create tables with oids like this:
CREATE TABLE myTable (<columns>) WITH OIDS; --- notice " WITH OIDS"
You can also do:
CREATE TABLE myTable AS SELECT ... FROM ... WITH OIDS;

FYI - other postgis bugs:

         GEOS-470 (sql errors not being reported)
         GEOS-597 (sql injection)

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira