Issue Details (XML | Word | Printable)

Key: CORE-3601
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Adriano dos Santos Fernandes
Reporter: Radek Palmowski
Votes: 0
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Incorrect TEXT BLOB charset transliteration on VIEW with trigger

Created: 16/Sep/11 10:25 AM   Updated: 23/Apr/13 01:12 PM
Component/s: Charsets/Collation, Engine
Affects Version/s: 3.0 Initial, 2.5.0
Fix Version/s: 2.5.2, 3.0 Alpha 1

Time Tracking:
Not Specified

Planning Status: Unspecified


 Description  « Hide
On UTF8 connection:
isc_get_segment from V_T_TEST.MEMO_UTF8 V_T_TEST.MEMO_WIN1250 returns buffer as utf-8 string
but
isc_put_segment on V_T_TEST.MEMO_UTF8 with buffer as utf-8 is OK
isc_put_segment on V_T_TEST.MEMO_WIN1250 with buffer as utf-8 not transliterate character set and stores in table incorrect as utf-8
isc_put_segment on V_T_TEST.MEMO_WIN1250 with buffer as win1250 report error malformed string

on table T_TEST isc_get_segment, isc_put_segment with buffer utf-8 works OK


CREATE TABLE T_TEST (
    ID UID NOT NULL /* UID = BIGINT */,
    MEMO_UTF8 MEMO_UTF8 /* MEMO_UTF8 = BLOB SUB_TYPE 1 SEGMENT SIZE 100 */,
    MEMO_WIN1250 MEMO_WIN1250 /* MEMO_WIN1250 = BLOB SUB_TYPE 1 SEGMENT SIZE 100 */,
    MEMO_OCTETS MEMO_OCTETS /* MEMO_OCTETS = BLOB SUB_TYPE 1 SEGMENT SIZE 100 */
);

ALTER TABLE T_TEST ADD CONSTRAINT PK_T_TEST PRIMARY KEY (ID);

CREATE OR ALTER VIEW V_T_TEST(
    ID,
    MEMO_UTF8,
    MEMO_WIN1250,
    MEMO_OCTETS)
AS
SELECT
  T.ID,
  T.MEMO_UTF8,
  T.MEMO_WIN1250,
  T.MEMO_OCTETS
FROM T_TEST T
;

SET TERM ^ ;


/* Trigger: V_T_TEST_BD */
CREATE OR ALTER TRIGGER V_T_TEST_BD FOR V_T_TEST
ACTIVE BEFORE DELETE POSITION 0
AS
BEGIN
  DELETE FROM T_TEST
  WHERE ID = OLD.ID;
END
^


/* Trigger: V_T_TEST_BI */
CREATE OR ALTER TRIGGER V_T_TEST_BI FOR V_T_TEST
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  INSERT INTO T_TEST(
    ID,
    MEMO_UTF8,
    MEMO_WIN1250,
    MEMO_OCTETS)
  VALUES(
    NEW.ID,
    NEW.MEMO_UTF8,
    NEW.MEMO_WIN1250,
    NEW.MEMO_OCTETS);
END
^


/* Trigger: V_T_TEST_BU */
CREATE OR ALTER TRIGGER V_T_TEST_BU FOR V_T_TEST
ACTIVE BEFORE UPDATE POSITION 0
AS
BEGIN
  UPDATE T_TEST SET
    ID = NEW.ID,
    MEMO_UTF8 = NEW.MEMO_UTF8,
    MEMO_WIN1250 = NEW.MEMO_WIN1250,
    MEMO_OCTETS = NEW.MEMO_OCTETS
  WHERE ID = OLD.ID;
END
^

SET TERM ; ^



 All   Comments   Work Log   Change History   Version Control   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Adriano dos Santos Fernandes added a comment - 16/Sep/11 10:39 AM
Please show us the MEMO_* create domain commands.

Radek Palmowski added a comment - 16/Sep/11 10:43 AM
CREATE DOMAIN MEMO_UTF8 AS
BLOB SUB_TYPE 1 SEGMENT SIZE 100 CHARACTER SET UTF8;

CREATE DOMAIN MEMO_WIN1250 AS
BLOB SUB_TYPE 1 SEGMENT SIZE 100 CHARACTER SET WIN1250;

CREATE DOMAIN MEMO_OCTETS AS
BLOB SUB_TYPE 1 SEGMENT SIZE 100 CHARACTER SET OCTETS;

Radek Palmowski added a comment - 16/Sep/11 12:03 PM - edited
On Win1250 connection:
isc_get_segment from V_T_TEST.MEMO_WIN1250 returns buffer as win1250 string
isc_get_segment from V_T_TEST.MEMO_UTF8 returns buffer as win1250 string
but
isc_put_segment on V_T_TEST.MEMO_WIN1250 with buffer as win1250 is OK
isc_put_segment on V_T_TEST.MEMO_UTF8 with buffer as win1250 report error transliterate between character sets
isc_put_segment on V_T_TEST.MEMO_UTF8 with buffer as utf-8 works

It looks as if the transliterating was only for reading from VIEW and the writing is no longer.

Radek Palmowski added a comment - 19/Sep/11 10:40 AM
It is possible to backport to version 2.5?

Adriano dos Santos Fernandes added a comment - 11/Dec/11 01:26 AM
Fix backported to 2.5.2.