[postgis-users] database wide unique ID

Roald de Wit postgis at evolvere.nl
Mon Jul 23 07:51:10 PDT 2007


Hi Milo,

If I'm correct, the easiest way is to use the internal OID of PostgreSQL 
table rows. Before 8.1 all created tables automatically had one. After 
that, you'd have to specify 'WITH OIDS' yourself in the 'CREATE TABLE' 
statement. Of course there are some drawbacks: OIDs are database wide 
and can turn over (i.e. reset) if you have too many rows. Backup and 
restore can give you headaches when you use OID as foreign keys.

Does this help you?

Regards,

Roald

mlinden at zeelandnet.nl wrote:
> Hello list!
>
> Thanks to you all I have my first real import ready. Of course this is not
> enough for my employer ;-)
>
> For some extra functionality that is needed, we need a database wide
> unique ID. This is because our postGIS database will feed another (MSSQL)
> database with some sort of key index. In the MSSQL database, no difference
> is made between point,line and poly. Therefor my three tables (mypoint,
> myline and mypoly) need to have system wide ID's so I can return a
> relational table to MSSQL.
>
> Is there anyone that know how to generate a database wide unique ID?
>
> Thanks in advance!
>
> Milo van der Linden
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>   




More information about the postgis-users mailing list