[postgis-users] Dilemma: is gid really useful in a geoDB?

Paul Ramsey pramsey at refractions.net
Wed Feb 21 09:39:59 PST 2007


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 at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users


-- 

   Paul Ramsey
   Refractions Research
   http://www.refractions.net
   pramsey at refractions.net
   Phone: 250-383-3022
   Cell: 250-885-0632



More information about the postgis-users mailing list