Bug #18244 [Opn->WFx]: table name lenght problem in create constraint!
| From: | danielc at analysisandsolutions dot com | Date: | Thu, 25 Oct 2012 20:39:35 +0000 |
| Subject: | Bug #18244 [Opn->WFx]: table name lenght problem in create constraint! | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-9240@lists.php.net to get a copy of this message | ||
Edit report at https://pear.php.net/bugs/bug.php?id=18244&edit=1
ID: 18244
Updated by: danielc@analysisandsolutions.com
Reported By: irangame at gmail dot com
Summary: table name lenght problem in create constraint!
-Status: Open
+Status: Wont fix
Type: Bug
Package: MDB2_Driver_mysqli
Operating System: Windows 7
Package Version: 1.5.0b3
PHP Version: 5.2.12
-Assigned To:
+Assigned To: danielc
Roadmap Versions:
New Comment:
-Status: Open
+Status: Wont fix
-Assigned To:
+Assigned To: danielc
We can't do anything about the database server's limits. Use shorter
names.
Previous Comments:
------------------------------------------------------------------------
[2011-02-06 21:29:04] irangame
Description:
------------
When i want to set a foreign key to 'sms_contact_group_members' table,
this error occurred.(trigger name is too long for create)
It seems that, you add a prefix and suffix to table name for creating
trigger.
you can use abbreviation of your words to solve this problem :)
Thanks and good luck,
-Mojtaba Ebrahimi-
Test script:
---------------
<table>
<name><variable>table_prefix</variable>sms_contact_group_members</name>
<declaration>
<field>
<name>contact_id</name>
<type>integer</type>
<notnull>true</notnull>
</field>
<field>
<name>group_id</name>
<type>integer</type>
<notnull>true</notnull>
</field>
<index>
<name><variable>table_prefix</variable>sms_contact_group_members_ci</name>
<field>
<name>contact_id</name>
</field>
</index>
<index>
<name><variable>table_prefix</variable>sms_contact_group_members_gi</name>
<field>
<name>group_id</name>
</field>
</index>
<foreign>
<name>cg_members_fk1</name>
<ondelete>RESTRICT</ondelete>
<onupdate>RESTRICT</onupdate>
<field>contact_id</field>
<references>
<table><variable>table_prefix</variable>sms_contacts</table>
<field>id</field>
</references>
</foreign>
</declaration>
</table>
Expected result:
----------------
MDB2 Error: unknown error : _doQuery: [Error message: Could not execute
statement]
[Last executed query: CREATE TRIGGER cg_members_fk1_pk_delete_trg BEFORE
DELETE ON sms_contacts FOR EACH ROW BEGIN SET FOREIGN_KEY_CHECKS = 0;
IF (SELECT
sms_contact_group_members.contact_id AS contact_id FROM
sms_contact_group_members WHERE contact_id = OLD.id) IS NOT NULL THEN
CALL
delete_ON_TABLE_sms_contact_group_members_VIOLATES_FOREIGN_KEY_CONSTRAINT();
END IF; SET FOREIGN_KEY_CHECKS = 1; END;]
[Native code: 1059]
[Native message: Identifier name
'delete_ON_TABLE_sms_contact_group_members_VIOLATES_FOREIGN_KEY_CONSTRAINT'
is too long]
------------------------------------------------------------------------
--
Edit this bug report at https://pear.php.net/bugs/bug.php?id=18244&edit=1