why does postgres upsert fails while reading data from oracle. how to make the column case insensitive while using postgres upsert. when i use a mapper to change the column case it worked fine. Is this a known issue ? Note : Postgres Insert throws no such error.
$.mapKeys((value, key) => key.toLowerCase()) this worked
Great to hear it worked! ๐ Here's a quick breakdown of what that expression does: --- Expression: $.mapKeys((value, key) => key.toLowerCase()) What it does This expression transforms all keys of the current input document ($) to lowercase. How it works | Part | Description | |---|---| | $ | Refers to the entire current input document (a JSON object) | | .mapKeys(fn) | Iterates over every key-value pair in the object and replaces each key with the return value of the function | | (value, key) => key.toLowerCase() | An arrow function that takes each value and key, and returns the key converted to lowercase | Example Input:
json
{
"FirstName": "Alice",
"LAST_NAME": "Smith",
"Age": 30
}
Output:
json
{
"firstname": "Alice",
"last_name": "Smith",
"age": 30
}
๐ก Note: Only the keys are transformed โ the values remain unchanged.
--- This is a handy pattern for normalizing field names, especially when dealing with inconsistent casing from upstream sources. Let me know if you'd like to extend this further, such as also transforming values or filtering specific keys!
