odc icon indicating copy to clipboard operation
odc copied to clipboard

[Bug]: Type and Package contents were replaced with utf8mb4 when loading sql file using ODC import functionality

Open alvinloong opened this issue 2 years ago • 0 comments

ODC version

版本号:4.2.3 Server: 4.2.3-20231225 Release Date: 2023-12-25

OB version

Server version: OceanBase 4.2.1.3 (r103030022024011313-c6afef2be5748fc54b1b0159b5224ae288491424) (Built Jan 13 2024 13:36:43)

What happened?

Here is the test case: test_odc_import_issue.zip

After import the sql files using ODC,

There are two issues: Issue 1 || 'BillCharSet=>' || '''' || trim(BillCharSet) || '''' is replaced by || 'BillCharSet= utf8mb4 || '''' || trim(BillCharSet) || '''',

Issue 2 SET BillCHARSET = pt_ty_test_charset.BillCharSet; is replaced by SET BillCHARSET= utf8mb4;

What did you expect to happen?

ODC should not replaced contents of Type or Package.

How can we reproduce it (as minimally and precisely as possible)?

Here is the test case: test_odc_import_issue.zip

Step 1 load 1_test_odc_import_issue_create_table_and_type.sql using ODC import functionality

ODC log shows syntax error from which we can see that || 'BillCharSet=>' || '''' || trim(BillCharSet) || '''' is replaced by || 'BillCharSet= utf8mb4 || '''' || trim(BillCharSet) || '''',

i.e. >' is replaced with utf8mb4 which is unexpected.

"/opt/odc/./data/data_transfer/2000025/import_upload_1705394179794_1_test_odc_import_issue_create_table_and_type.sql" exec failure. (3/3). Reason: ORA-00900: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near ')' at line 12. SQL: create TYPE BODY ty_test_charset IS
  CONSTRUCTOR FUNCTION ty_test_charset RETURN SELF AS RESULT IS
  BEGIN
    RETURN;
  END;

  MEMBER FUNCTION test_toString RETURN VARCHAR2 IS
    l_string VARCHAR2(4000);
  BEGIN
    l_string:='ty_test_charset('
      || 'BillCharSet= utf8mb4 || '''' || trim(BillCharSet) || ''''
      || ')';

    RETURN l_string;
  EXCEPTION
    WHEN OTHERS THEN
      RETURN NULL;
  END;
END;
2024-01-16 16:36:34 [INFO] shutdown task context finished
2024-01-16 16:36:34 [INFO] ----------	Finished Tasks: 1	Running Tasks: 0	Progress: 100.00%	----------
2024-01-16 16:36:34 [INFO] 

All Load Tasks Finished: 

Step 2 load 2_test_odc_import_issue_create_package.sql using ODC import functionality

From the follow image, we can see that SET BillCHARSET = pt_ty_test_charset.BillCharSet; is replaced by SET BillCHARSET= utf8mb4; which should not happen.

image

And the package shows errror ORA-00904: invalid identifier 'UTF8MB4' in 'field list' at line 4, position 6

image

Anything else we need to know?

Temporary solution: Run the sqls in ODC SQL windows manually, NO errors.

Cloud

No response

alvinloong avatar Jan 16 '24 09:01 alvinloong