Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-5521

LogMiner DML parser incorrectly interprets concatenation operator inside quoted column value

XMLWordPrintable

      In order to make your issue reports as actionable as possible, please provide the following information, depending on the issue type.

      Bug report

      Since PR,
      LogminerDmlParser convert double vertical bar to single vertical bar

      The simple expression of the test code is as follows.
      [Sample Test Code] 

      'I||am' >  'I|am'

       

      @Test
      public void testDoubleBlocker() throws Exception {
          final Table table = Table.editor()
                  .tableId(new TableId(null, "UNKNOWN", "TABLE"))
                  .addColumn(Column.editor().name("COL1").create())
                  .create();
      
          String sql = "update \"UNKNOWN\".\"TABLE\" set \"COL1\" = 'I||am' where \"COL1\" = 'I||am'";
          System.out.println("====== UPDATE =======");
          System.out.println(sql);
      
          LogMinerDmlEntry entry = fastDmlParser.parse(sql, table);
          assertThat(entry.getEventType()).isEqualTo(EventType.UPDATE);
          assertThat(entry.getNewValues()).hasSize(1);
          assertThat(entry.getNewValues()[0]).isEqualTo("I|am");
          assertThat(entry.getOldValues()).hasSize(1);
          assertThat(entry.getOldValues()[0]).isEqualTo("I||am");
      
          System.out.println("====== OLD VALUES =======");
          for (Object oldValue : entry.getOldValues()) {
              System.out.println(oldValue.toString());
          }
      
          System.out.println("====== NEW VALUES =======");
          for (Object newValue : entry.getNewValues()) {
              System.out.println(newValue.toString());
          }
      
          sql = "insert into \"UNKNOWN\".\"TABLE\" (\"COL1\") values ('I||am')";
          System.out.println("====== INSERT =======");
          System.out.println(sql);
      
          entry = fastDmlParser.parse(sql, table);
          System.out.println("====== NEW VALUES =======");
          for (Object newValue : entry.getNewValues()) {
              System.out.println(newValue.toString());
          }
      
          assertThat(entry.getEventType()).isEqualTo(EventType.INSERT);
          assertThat(entry.getNewValues()).hasSize(1);
          assertThat(entry.getNewValues()[0]).isEqualTo("I||am");
      } 

       

       

      [Result] 

      [INFO] Running io.debezium.connector.oracle.logminer.LogMinerDmlParserTest
      ====== UPDATE =======
      update "UNKNOWN"."TABLE" set "COL1" = 'I||am' where "COL1" = 'I||am'
      ====== OLD VALUES =======
      I||am
      ====== NEW VALUES =======
      I|am
      ====== INSERT =======
      insert into "UNKNOWN"."TABLE" ("COL1") values ('I||am')
      ====== NEW VALUES =======
      I||am
      [INFO] Tests run: 14, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s - in io.debezium.connector.oracle.logminer.LogMinerDmlParserTest 

      PR is about escaped single quote.
      1) But is it intended to be "double vertical bar to single vertical bar"?

      else if (nested == 0 & c == '|' && lookAhead == '|') {
          // Concatenation
          for (int i = index + 2; i < sql.length(); ++i) {
              if (sql.charAt(i) != ' ') {
                  // found next non-whitespace character
                  index = i - 1;
                  break;
              }
          }
      } 

       

      2) And, should we consider concatenation statements in the redo log?
      [Query]

      include concatenation where clause.

      UPDATE SMARTUX.PT_HDTV_BBS SET BBS_ID  = 'pu001' WHERE REG_NO =  '1' || '22'; 

      [Redo Log]

      concatenation not shown

      update "SMARTUX"."PT_HDTV_BBS" set "BBS_ID" = 'pu001' where "REG_NO" = 122

      **

       

      What Debezium connector do you use and what version?

      1.9.4

            ccranfor@redhat.com Chris Cranford
            seungpil@mz.co.kr Seungpil Park (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: