Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-34901

Update clause must EXCLUDED unique index

    XMLWordPrintableJSON

Details

    Description

      When writing Postgres data using flinke-connector-jdbc, using upsert mode, As docs 'https://www.postgresql.org/docs/current/sql-insert.html', when we use ON CONFLICT, Update clause must EXCLUDED unique index.
      Or it will throw exceptions.like " modification of distribution columns in OnConflictUpdate is not supported Call getNextException to see other errors in the batch."

      Whether you can modify the code is as follows:
      String updateClause =
              

      Arrays.stream(fieldNames)
      .filter(fieldName -> !Arrays.asList(uniqueKeyFields).contains(fieldName))
      .map(f -> quoteIdentifier(f) + "=EXCLUDED." + quoteIdentifier(f))
      .collect(Collectors.joining(", "));

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ouyangwuli ouyangwulin
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: