CockroachDB: select and transfer bytes & # 8594; line type
I have a request to store a UUIDv4 as a byte type in CockroachDB (v1.0). Its generated with Cockroach documented the uuid_v4 () function. When selected, the results are returned with a byte type, for example:
"\ x9d \ xce` \ xb3p \ x9aKB \ XBE \ Xba \ xeb \ XEC ~ \ x9e \ XFB \ x93"
while the goal is to output the uuidv4 line like:
"ABCD-12345-asdifoekc"
I've read the docs about casting: https://www.cockroachlabs.com/docs/data-types.html#data-type-conversions--casts , but still can't figure out how to do it when executing a SELECT statement.
+3
source to share
1 answer
With the from_uuid()
following built in:
root@:26257/> SELECT from_uuid(uuid_v4());
+--------------------------------------+
| from_uuid(uuid_v4()) |
+--------------------------------------+
| 4817bb15-4d93-4b77-b7d1-1e5cfb8360e3 |
+--------------------------------------+
(1 row)
+4
source to share