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

Stephen Woodbridge woodbri at swoodbridge.com
Wed Feb 21 08:13:22 PST 2007


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



More information about the postgis-users mailing list