GUID in PostgreSQL...

GUID in PostgreSQL...

Postby burning snow » Sun 09 Sep 2007 11:00

Hi folks,

Since I'm converting a project from MSSQL to PostgreSQL I don't know how to handle the GUID / uniqueidentifier Fields.

I know that PostgreSQL doesn't have this datatype but what is the best practice for this kind of problem?

Thank you very much in advance.
burning snow
 
Posts: 6
Joined: Sun 09 Sep 2007 10:26

Postby Alexey » Mon 10 Sep 2007 08:22

If you need unique identifier of each record, use the following syntax:
Code: Select all
CREATE TABLE tablename
(
  ...
)
WITH OIDS;

For more information about oids please see PostgreSQL Server documentation.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby burning snow » Sun 30 Sep 2007 12:35

It is not possible to use OID for my problem.

Why?

In the PostgreSQL Documentation (http://www.postgresql.org/docs/8.2/interactive/datatype-oid.html) it says that I can't use it like I use GUID on a MSSQL Database.

The oid type is currently implemented as an unsigned four-byte integer. Therefore, it is not large enough to provide database-wide uniqueness in large databases, or even in large individual tables. So, using a user-created table's OID column as a primary key is discouraged. OIDs are best used only for references to system tables.


Isn't it possible to create a new type for PostgreSQL and use it with CoreLab Data Provider?
burning snow
 
Posts: 6
Joined: Sun 09 Sep 2007 10:26

Postby Alexey » Mon 01 Oct 2007 07:16

As far as we know, it is not possible to create new types in PostgreSQL Server.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43


Return to dotConnect for PostgreSQL