Bug latin1 charset
Posted by: Danilo Pimentel
Date: July 14, 2006 11:39AM

Hi friends,

I have an error ocurred in my server when I execute an UPDATE in a TABLE named 'táblé1'.

Follow script for demonstrate the problem.

/* BEGIN OF SCRIPT */

/* works With quotes */

SET sql_mode = 'ANSI_QUOTES';

/* Drop tables If exists */

DROP Table If EXISTS "táblé1";
DROP Table If EXISTS "táblé2";

/* Create new tables */

CREATE Table "táblé1"
(
"code1" varchar (4) Default '' NOT NULL,
"description1" varchar (80) Default '' NOT NULL
);

CREATE Table "táblé2"
(
"code2" varchar (4) Default '' NOT NULL,
"description2" varchar (80) Default '' NOT NULL,
"code1" varchar (4) Default '' NOT NULL
);

/* Create trigger */

DELIMITER ^
CREATE TRIGGER "table1_trg_upd" BEFORE Update On "táblé1" For Each Row
Begin
Declare i INT;
If (OLD."code1" <> NEW."code1") Then
UPDATE "táblé2"
SET "code1" = NEW."code1"
WHERE "code1" = OLD."code1";
End If;
End ^
DELIMITER ;

DELIMITER ^
CREATE TRIGGER "table2_trg_upd" BEFORE UPDATE ON "táblé2" FOR EACH ROW
BEGIN
DECLARE i INT;
IF (OLD."code1" <> NEW."code1") THEN
SET i = 0;
SELECT COUNT(*) INTO i FROM "táblé1";
IF (i = 0) THEN

/* Any code here... */
SET i = 2;
/* Any code here... */

END IF;
END IF;
END ^
DELIMITER ;

/* END OF SCRIPT */

To reproduce the error just add a new row in table 'táblé1' and after update this data with any diferent values.

The server will response with message: "Table 'teste.tÃ!@AS!@#2` doesn't exist', I don't see any relation to this problema.

The error occur because the trigger "table2_trg_upd" include the select expression:

SELECT COUNT(*) INTO i FROM "táblé1";

If I remove this select of the trigger, execution occur whithout any problem.

The characterset of database and connection is 'latin1', and error occurr just in cases of tables with "accent" characters, like 'táblé1' or 'táblé2'.

PS: I try to report this bug to bugs.mysql.com but the form return me an error.... :-(

Can anyone help me? Have any error in my script?

Thanks for all.

Danilo Pimentel

Options: ReplyQuote


Subject
Views
Written By
Posted
Bug latin1 charset
2209
July 14, 2006 11:39AM
1506
July 16, 2006 08:21AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.