UUID 最大字符长度 [英] UUID max character length

查看:365
本文介绍了UUID 最大字符长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用 UUID 作为 out oracle DB 的主键,并尝试为 VARCHAR 确定适当的最大字符长度.显然这是 36 个字符,但我们注意到生成的 UUID 比这更长 - 长度最多为 60 个字符.有谁知道 UUID 合适的最大字符长度??

We are using UUID as primary key for out oracle DB, and trying to determine an appropriate max character length for the VARCHAR. Apparently this is 36 characters but we have noticed UUID'S generated which are longer than this - up to 60 characters in length. Does anyone know a suitable max char length for UUID??

推荐答案

RFC4122 的第 3 节 提供了 UUID 字符串表示的正式定义.它是 36 个字符(32 个十六进制数字 + 4 个破折号).

Section 3 of RFC4122 provides the formal definition of UUID string representations. It's 36 characters (32 hex digits + 4 dashes).

听起来您需要弄清楚无效的 60 字符 ID 的来源并决定 1) 是否要接受它们,以及 2) 这些 ID 的最大长度可能基于所使用的任何 API生成它们.

Sounds like you need to figure out where the invalid 60-char IDs are coming from and decide 1) if you want to accept them, and 2) what the max length of those IDs might be based on whatever API is used to generate them.

这篇关于UUID 最大字符长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆