« Return to Thread: Dilemma: is gid really useful in a geoDB?

Re: Dilemma: is gid really useful in a geoDB?

by Paolo Corti :: Rate this Message:

Reply to Author | View in Thread

exactly, adding the gid column is a convenience
in some case is mandatory
zigGis, the OS PostGIS connector for ArcGis, is for example waiting to always have the gid field defined, otherwise it won't work.
Some other software can work even without it (QGis, but still needs a primary key), but in the case of Esri GDB model there is a mandatory OID integer field that will be translated from the gid field of a PostGIS layer, and there is no way to avoid to add the gid field in PostGIS tables.
At this time zigGIs is assuming that the OID field is named gid, but maybe we can reconsider the thing, and make it this name configurable in configuration file....

Paolo Corti


Paul Ramsey wrote:
Correct, almost all client applications require a primary key.  Many
require that the primary key be a single column.  shp2pgsql creates a
'gid' automatically, but you could always drop it if you wanted some
other primary key.

Stephen Woodbridge wrote:
> Antonello wrote:
>> Hi list,
>>
>> I have a dilemma: is gid really useful in a geoDB?
>> I am building a geodb for several harbor. When I create a layer(table
>> with geometry) in postgis, I need a gid like a primary key, or I can
>> use a different one? Can I  use several field of from the table like a
>> primary key?
>>
>> I am not new in the gis, but why in almost all geoDB I saw there is a
>> gid?! Is it really necessary? Do it come from shapefile standards?
>>
>> For example QuantumGIS doesn't work if the layer has only one primary
>> key, there are other application that don't work like qGis?
>>
>
> Hello Antonello,
>
> There is basically a requirement to have some kind of unique way of
> accessing any given record. This is so programs can update the record or
> fetch the records later based on a unique id. Also some systems might
> expect that the uid be an integer. So adding the gid column is a
> convenience.
>
> If you know your usage patterns and you know the requirements for the
> software you are using with the database, then you can probably safely
> remove or change it to something else. I don't think gid needs to be the
> primary key if you have something else, you could just make the gid a
> unique column.
>
> -Steve
> _______________________________________________
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users


--

   Paul Ramsey
   Refractions Research
   http://www.refractions.net
   pramsey@refractions.net
   Phone: 250-383-3022
   Cell: 250-885-0632
_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

 « Return to Thread: Dilemma: is gid really useful in a geoDB?