Hi, 

Yes, as Anoop explained, unique_id() is not documented and it returns binary 
data type, so one will see strange displaying. The right usage is for 
application to get the raw data for its own purpose or use convertohex if just 
for human readability. However, I don't see unique_id() used in other popular 
databases?? I am not sure, but brief searching the internet , it didn't return 
any result. So IMHO, there is no standard of this function. 
And according to below, I don't think we need to encourage user to use it , 
since it is Trafodion specific. So, maybe it is better not to document it.

I added MySQL style uuid()/uuid_short() few weeks before, some trafodion users 
want them. uuid() will return standard UUID/GUID in form of CHAR(36), and 
uuid_short() returns a long value representing the UUID as standard defined: 
https://en.wikipedia.org/wiki/Universally_unique_identifier 

Trafodion now uses Linux libuuid to generate the UUID. Libuuid conforms to OSF 
DCE 1.1. libuuid is used by CentOS/RHEL widely to generate block device ID. But 
I am not sure if it is also widely used in ubuntu and other linux dists, so 
this really needs more discussion, maybe it is NOT a good idea to use libuuid 
from portability point of view.
I plan to add document for uuid/uuid_short asap.

If required, I plan to add Oracle syntax sys_guid() in the future as well for 
compatibility and make migration easier. But I didn't hear the requirements 
from users yet ^_^

Ming

-----Original Message-----
From: Anoop Sharma <anoop.sha...@esgyn.com> 
Sent: Saturday, March 10, 2018 12:55 PM
To: dev@trafodion.apache.org
Subject: RE: unique_id() not documented and get messy code

latest trafodion code that will be part of traf 2.3 will generate a 36 byte 
unique id
in string format.

      Apache Trafodion Conversational Interface 2.3.0
      Copyright (c) 2015-2017 Apache Software Foundation
      >>select unique_id() from dual;

      (EXPR)
      ------------------------------------

      b2d1426c-4459-4464-b733-8de9aa1e84ea

      --- 1 row(s) selected.
      >>

Prior code was generating a binary representation which will display as 
unprintable characters.
One can use converttohex function on top of it to convert it to hex 
representation.

Ming may have further comments.

anoop

-----Original Message-----
From: Liu, Yuan (Yuan) <yuan....@esgyn.cn>
Sent: Friday, March 9, 2018 6:40 PM
To: dev@trafodion.apache.org
Subject: unique_id() not documented and get messy code

Hi Trafodioneers,

It seems we support unique_id() but not documented.
I just tried it in trafci and get messy code.
SQL>select unique_id() from dual;

(EXPR)
----------------
v聦聢掳f脩T

--- 1 row(s) selected.

Is there something wrong?


Best regards,
Yuan


Reply via email to