mattp5657 commented on code in PR #3640:
URL: https://github.com/apache/iggy/pull/3640#discussion_r3611518915


##########
core/connectors/sources/postgres_source/src/lib.rs:
##########
@@ -1497,42 +1491,107 @@ fn to_snake_case(input: &str) -> String {
     result
 }
 
-fn parse_record_data(data: &str) -> serde_json::Map<String, serde_json::Value> 
{
+fn unquote_pg_identifier(segment: &str) -> String {
+    match segment.strip_prefix('"').and_then(|s| s.strip_suffix('"')) {
+        Some(inner) => inner.replace("\"\"", "\""),
+        None => segment.to_string(),
+    }
+}
+
+fn parse_record_columns(data: &str) -> serde_json::Map<String, 
serde_json::Value> {
     let mut result = serde_json::Map::new();
+    let bytes = data.as_bytes();
+    let len = bytes.len();
+    let mut pos = 0;
 
-    for part in data.split_whitespace() {
-        if let Some(bracket_pos) = part.find('[')
-            && let Some(_close_bracket) = part.find(']')
-            && let Some(colon_pos) = part.find(':')
-        {
-            let column_name = &part[..bracket_pos];
-            let value_str = &part[colon_pos + 1..];
+    while pos < len {
+        while pos < len && bytes[pos] == b' ' {
+            pos += 1;
+        }
+        if pos >= len {
+            break;
+        }
 
-            let cleaned_value = if value_str.starts_with('\'') && 
value_str.ends_with('\'') {
-                &value_str[1..value_str.len() - 1]
-            } else {
-                value_str
-            };
+        let Some(bracket_offset) = data[pos..].find('[') else {
+            break;
+        };
+        let name_end = pos + bracket_offset;
+        let column_name = &data[pos..name_end];

Review Comment:
   This should be done.



-- 
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