Message-ID: From: "crowmagnumb (@crowmagnumb)" To: "pgjdbc/pgjdbc" Date: Fri, 10 Jan 2025 21:42:23 +0000 Subject: Re: [pgjdbc/pgjdbc] PR #3396: SQLData Support In-Reply-To: References: List-Id: X-GitHub-Author-Login: crowmagnumb X-GitHub-Comment-Id: 2584349418 X-GitHub-Comment-Type: issue_comment X-GitHub-Edited-At: 2025-01-10T21:45:58Z X-GitHub-Issue: 3396 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/pull/3396#issuecomment-2584349418 Content-Type: text/plain; charset=utf-8 > Please note that this piece of code probably doesn't work the way you expect > > ``` > if (isWhitespace(ch)) { > ++charIdx; > while (charIdx < len && isWhitespace(value.charAt(charIdx))) { > ++charIdx; > } > break; > } > ``` > > You can run the method on such a line, for example, and verify this: > > ``` > "( "a" , "b" , "c" )" > ``` > > This code should find the index of the next non-whitespace character and call cotninue. > > And there is no need for a go-to label in this method. You can do without the label in readString too by replacing switch with if-else You are absolutely right. This parsing code I more or less got from the impossibl driver since I knew that it worked. I really didn't analyze it too much because it works for what postgresql gives you. But yeah, I'll clean it up. Cheers. I think it works just fine because postgresql doesn't give you any whitespace (no surprise there, why waste bytes on whitespace?). So tecnically we could probably just remove that check. But maybe best to have just in case? But make it work correctly. :)