为什么 Oracle 表/列/索引名称限制为 30 个字符?

2021-12-06 00:00:00 size oracle oracle10g

我可以理解很多年前会有这种限制,但现在这个限制肯定可以很容易地增加.我们有对象的命名约定,但总有一种情况会在我们达到此限制时出现 - 特别是在命名外键时.

I can understand that many years ago there would be this kind of limitation, but nowadays surely this limit could easily be increased. We have naming conventions for objects, but there is always a case that turns up where we hit this limit - especially in naming foreign keys.

有人真的知道为什么这不是更大的尺寸 - 还是 11 克更大?

Does anybody actually know why this isn't a bigger size - or is it bigger in 11g?

显然,答案是它会破坏当前未进行防御性编码的脚本.我说这是一件非常令人担忧的事情,Oracle 正在努力成为数据库,这肯定是您必须不断改进的那种东西,否则您的产品将死于千刀万剐.

Apparently the answer is that it will break currently scripts that aren't defensively coded. I say that is a very worrying thing, Oracle is trying to be the database, surely this is the kind of thing that you must constantly improve, otherwise your product will die the death of a thousand cuts.

每当我在内部看到这种反对意见时,我认为是时候硬着头皮解决了.如果人们在升级 Oracle 版本时运行了他们不检查或维护的脚本,那么让他们承担该选择的后果.为他们提供一个兼容性标志,将大小提高到 4000,然后在我创建必须不断数到 30 以检查名称是否为OK"的对象时为我节省浪费的时间.

Whenever I see this kind of objection in-house, I think it is time to bite the bullet and sort it out. If people are running scripts that they do not check or maintain when they upgrade Oracle versions, then let them suffer the consequences of that choice. Provide them a compatibility flag, up the size to 4000, then save me the wasted time when I'm creating objects of having to constantly count to 30 to check the name is 'OK'.

推荐答案

我相信这是 ANSI 标准.

I believe it's the ANSI standard.

实际上,我认为这是 SQL-92 标准.

Actually, I think it's the SQL-92 standard.

该标准的更高版本似乎可以选择允许 128 个字符的名称,但 Oracle 尚不支持此功能(或部分支持它,只要它允许 30 个字符.嗯.)

A later version of the standard appears to optionally allow for 128 character names, but Oracle doesn't yet support this (or has partial support for it, insofar as it allows 30 characters. Hmmm.)

在此页面上搜索F391,长标识符"... http://stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/ap_standard_sql001.htm

Search for "F391, Long identifiers" on this page... http://stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/ap_standard_sql001.htm

(寻找参考)

相关文章