newid() in postgres

From: "marcel(dot)beutner" <m(dot)beutner(at)googlemail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: newid() in postgres
Date: 2007-04-04 07:14:39
Message-ID: 1175670879.821142.237750@n59g2000hsh.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello NG,

Is there an equivalent in postgres for the newid() function like in
sqlserver? I need to generate a unique identifier in my select
statement:

SELECT "X", newid(), "Y" FROM "MyTable"

X
newid()
Y
------------------------------------------------------------------------------------------------------------
1 139A7882-CF95-7C44-AC64-DF4D18614CAD test
2 D4CD37FE-4BD6-954B-B188-0D5BE0BDCF0E test2
...

I've searched in the groups already, but couldn't find any helpful
information - only to use a sequence, which returns just a number and
not a unique identifier.

Thanks in advance

Marcel

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ben Trewern 2007-04-04 08:06:42 Re: Webappication and PostgreSQL login roles
Previous Message Manoj Lal 2007-04-04 06:42:48 Postgres 7.4: how to disconnect users without restarting postmaster