Foreign Key names can be too long as currently designed

RESOLVED FIXED in Bugzilla 3.2

Status

()

Bugzilla
Database
--
minor
RESOLVED FIXED
10 years ago
6 years ago

People

(Reporter: Greg Hendricks, Assigned: Max Kanat-Alexander)

Tracking

(Blocks: 1 bug)

unspecified
Bugzilla 3.2
Bug Flags:
approval +
approval3.2 +
blocking3.2 +

Details

Attachments

(1 attachment, 1 obsolete attachment)

v1
3.60 KB, patch
Greg Hendricks
: review+
Details | Diff | Splinter Review
(Reporter)

Description

10 years ago
Testopia uses rather long and descriptive table and field names. When trying to add foreign keys, I often run into "key name too long" errors. 

We need a way to shorten these names if they are too long, before the database barfs.

See sub _get_fk_name in Bugzilla/DB/Schema.pm
(Reporter)

Updated

10 years ago
Summary: Foreign Key names can be too long as currntly designed → Foreign Key names can be too long as currently designed
(Reporter)

Comment 1

10 years ago
mysql --version

mysql  Ver 14.12 Distrib 5.0.51a, for suse-linux-gnu (i686) using readline 5.2
(Reporter)

Updated

10 years ago
Flags: blocking3.2?
(Assignee)

Comment 2

10 years ago
Can you get me the max length allowed?
Severity: normal → minor
OS: Linux → All
Hardware: PC → All
Target Milestone: --- → Bugzilla 3.2
(Assignee)

Comment 3

10 years ago
In order for the next release of Testopia to be compatible with Bugzilla 3.2, we at least need to decide on an implementation for this before we release Bugzilla 3.2 (if we don't check in the patch, we should still have an implementation that Testopia could patch in).
Flags: blocking3.2? → blocking3.2+
(Assignee)

Comment 4

10 years ago
ghendricks--it would actually be good for you to look into implementing this. I'd suggest using the exact method that Oracle uses now, which should be a very easy patch.
(Assignee)

Comment 5

10 years ago
Oh, and we'll also need a MAX_IDENTIFIER_LEN constant for each DB.
(Assignee)

Updated

10 years ago
Assignee: database → mkanat
(Reporter)

Comment 6

10 years ago
(In reply to comment #4)
> ghendricks--it would actually be good for you to look into implementing this.
> I'd suggest using the exact method that Oracle uses now, which should be a very
> easy patch.

I am not clear on how Oracle does this. In looking at the Oracle.pm module, I see it uses triggers. Is this what you had in mind?
(Assignee)

Comment 7

10 years ago
No, no. I mean how it overrides get_fk_name (or whatever the method is called).

Comment 8

10 years ago
Created attachment 345385 [details]
cert. evolution
(Assignee)

Comment 9

10 years ago
Comment on attachment 345385 [details]
cert. evolution

This has nothing to do with this bug.
Attachment #345385 - Attachment is obsolete: true
(Assignee)

Comment 10

10 years ago
Created attachment 346482 [details] [diff] [review]
v1

Okay, here we go. This should do it. In the future I want to do this for index names too, but only once we auto-name indexes.
Attachment #346482 - Flags: review?(ghendricks)
(Reporter)

Updated

10 years ago
Attachment #346482 - Flags: review?(ghendricks) → review+
(Assignee)

Updated

10 years ago
Flags: approval3.2+
Flags: approval+
(Assignee)

Comment 11

10 years ago
tip:

Checking in Bugzilla/DB/Schema.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/DB/Schema.pm,v  <--  Schema.pm
new revision: 1.107; previous revision: 1.106
done
Checking in Bugzilla/DB/Schema/Oracle.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/DB/Schema/Oracle.pm,v  <--  Oracle.pm
new revision: 1.8; previous revision: 1.7
done

3.2:

Checking in Bugzilla/DB/Schema.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/DB/Schema.pm,v  <--  Schema.pm
new revision: 1.99.2.1; previous revision: 1.99
done
Checking in Bugzilla/DB/Schema/Oracle.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/DB/Schema/Oracle.pm,v  <--  Oracle.pm
new revision: 1.5.2.3; previous revision: 1.5.2.2
done
Status: NEW → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → FIXED

Updated

6 years ago
Blocks: 540589
You need to log in before you can comment on or make changes to this bug.