[ 
https://issues.apache.org/jira/browse/FLINK-34901?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ouyangwulin updated FLINK-34901:
--------------------------------
    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 =
        
{code:java}
Arrays.stream(fieldNames)
.filter(fieldName -> !Arrays.asList(uniqueKeyFields).contains(fieldName))
.map(f -> quoteIdentifier(f) + "=EXCLUDED." + quoteIdentifier(f))
.collect(Collectors.joining(", "));{code}

  was:
When writing Postgres data using flinker-connector-jdbc, using upsert mode, we 
need only update no uniqueColumns to improve performance.
 
Whether you can modify the code is as follows:
String updateClause =
        
{code:java}
Arrays.stream(fieldNames)
.filter(fieldName -> !Arrays.asList(uniqueKeyFields).contains(fieldName))
.map(f -> quoteIdentifier(f) + "=EXCLUDED." + quoteIdentifier(f))
.collect(Collectors.joining(", "));{code}


> Update clause must EXCLUDED unique index
> ----------------------------------------
>
>                 Key: FLINK-34901
>                 URL: https://issues.apache.org/jira/browse/FLINK-34901
>             Project: Flink
>          Issue Type: Bug
>          Components: Connectors / JDBC
>    Affects Versions: jdbc-3.1.2
>            Reporter: ouyangwulin
>            Priority: Critical
>              Labels: pull-request-available
>
> 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 =
>         
> {code:java}
> Arrays.stream(fieldNames)
> .filter(fieldName -> !Arrays.asList(uniqueKeyFields).contains(fieldName))
> .map(f -> quoteIdentifier(f) + "=EXCLUDED." + quoteIdentifier(f))
> .collect(Collectors.joining(", "));{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to