From: | "jerry(dot)evans(at)chordia" <jerry(dot)evans(at)chordia(dot)co(dot)uk> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Analogue to SQL Server UniqueIdentifier? |
Date: | 2008-02-16 16:30:30 |
Message-ID: | 03c101c870b9$3fd1bdb0$0565a8c0@p424 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi
My porting experiment has encountered the SQL Server UniqueIdentifier problem. I can see one or two suggestions about this have been made over the years but I'd like to try and stay close to the original. So:
I'm wondering if I can use a combination of a domain 'hack' for syntatic compatibillity and an externally implemented function to handle generation.
More specifically, given a table defined thus:
CREATE TABLE jazz(
UUID UniqueIdentifier DEFAULT newIdentifier(),
rootname VARCHAR(255),
data_source VARCHAR(1024),
date_created DATETIME DEFAULT GETDATE())
1. Can I handle the UniqueIdentifier datatype via a domain that aliases UniqueIdentifier to char(X) (for example) ? This seems to work fine for the DATETIME datatype.
2. Implement newIdentifier() in some extension DLL that simply calls CoCreateGUID() ?
or does uuid-ossp do this for me?
Thx.
Jerry.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2008-02-16 16:47:20 | Re: Strict-typing benefits/costs |
Previous Message | Tom Lane | 2008-02-16 16:29:17 | Re: Timestamp indexes (why ">" or "between" does not use index?) |