[Gdal-dev] ogr2ogr creation of internal object id (oid) column in
pgsql table
Ted Spradley
tspradley at snoogems.com
Wed Sep 30 14:40:51 EDT 2009
Hi,
I have used ogr2ogr to load data from shapefile countyp020.shp into
db=project1, following Tyler Mitchell's 'Web Mapping Illustrated'.
> ogr2ogr -f "PostgreSQL" PG:dbname=project1 countyp020.shp
Tyler explains that: to optimize for Mapserver we can create an index on the
unique ID for the table. If we use a simple DATA statement in a map file:
DATA wkb_geometry from countyp020, Mapserver will use PostgreSQL's internal
object ID. The oid column doesn't appear in the column listing for a table,
but we can use it in a SELECT statement.
I am assuming:
SELECT oid FROM countyp020 LIMIT 1;
should return one value for the column 'oid'. Instead the return is:
ERROR: column "oid" does not exist
LINE 1: SELECT oid FROM countyp020 LIMIT 1;
^
So, when preparing the table for performance, the CREATE INDEX statement
fails.
project1=# CREATE INDEX idx_countyp020 ON countyp020 (oid);
ERROR: column "oid" does not exist
When the ogr2ogr command above is given, I am assuming that ogr2ogr creates
the SQL CREATE TABLE, and INSERT statements to hold the data from the
shapefile. And PostgreSQL, then does the table creation. Is the 'oid'
column created by default or do we somehow need to instruct ogr2ogr to add
'oid' as a column?
Thank you,
Ted S.
--
View this message in context: http://n2.nabble.com/ogr2ogr-creation-of-internal-object-id-oid-column-in-pgsql-table-tp3744541p3744541.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
More information about the gdal-dev
mailing list