emad60 opened a new pull request, #77507:
URL: https://github.com/apache/airflow/pull/77507

   `PostgresDialect.generate_replace_sql` documents `replace_target` as a 
"column name or list of column names", but a plain string was iterated 
character by character. For example:
   
       hook.insert_rows("t", rows, ["id", "name"], replace=True, 
replace_index="id", replace_target="name")
   
   generated
   
       ... ON CONFLICT (id) DO UPDATE SET n = excluded.n, a = excluded.a, m = 
excluded.m, e = excluded.e
   
   instead of `SET name = excluded.name`. That fails on columns that do not 
exist, or updates the wrong columns if the table happens to have single-letter 
ones.
   
   **Fix**
   
   A string `replace_target` is now wrapped in a list, the same way 
`replace_index` is already handled a few lines above.
   
   **Tests**
   
   Added a string case to the existing parametrized 
`test_generate_replace_sql_with_replace_target`. It fails without the fix.
   
   I ran the Postgres provider's unit tests locally (171 passed).
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Fable 5.2)
   
   Generated-by: Claude Code (Fable 5.2) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to