Subject: [pgjdbc/pgjdbc] PR #3727: Fixed issue #2538: parsing comment in callable statement

From: "raminorujov (@raminorujov)" <[email-masked]>
Date: Sun, 13 Jul 2025 23:00:58 +0000

Fixed parsing comment in callable statement causing syntax issue and preventing registration of out param

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing](https://github.com/pgjdbc/pgjdbc/blob/master/CONTRIBUTING.md) document?
* [x] Have you checked to ensure there aren't other open [Pull Requests](../../pulls) for the same update/change?

<!-- You can erase any parts of this template not applicable to your Pull Request. -->

### New Feature Submissions:

1. [x] Does your submission pass tests?
2. [x] Does `./gradlew styleCheck` pass ?
3. [x] Have you added your new test classes to an existing test suite in alphabetical order?

### Changes to Existing Features:

* [ ] Does this break existing behaviour? If so please explain.
* [x] Have you added an explanation of what your changes do and why you'd like us to include them?
* [x] Have you written new tests for your core changes, as applicable?
* [x] Have you successfully run tests with your changes locally?

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Mon, 14 Jul 2025 15:40:45 +0000

lgtm @vlsi  ?

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Mon, 14 Jul 2025 16:01:56 +0000

If we ever support comments there, is there a reason we allow only block comments? Why don't we support line comments as well?

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Mon, 14 Jul 2025 16:03:16 +0000

(on pgjdbc/src/test/java/org/postgresql/test/jdbc2/CallableStmtTest.java)

Have you considered `@ValueSource(strings=...)`?
`delimiter=#` looks somewhat excessive

---

From: "raminorujov (@raminorujov)" <[email-masked]>
Date: Mon, 14 Jul 2025 16:07:17 +0000

I've used original sample test from bug report, Implemented your suggestion.

---

From: "raminorujov (@raminorujov)" <[email-masked]>
Date: Mon, 14 Jul 2025 16:08:13 +0000

> If we ever support comments there, is there a reason we allow only block comments? Why don't we support line comments as well?

Do you want me to implement this? `A comment is an arbitrary sequence of characters beginning with double dashes and extending to the end of the line`:
```
-- This is a standard SQL comment
```

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Mon, 14 Jul 2025 16:25:01 +0000

> -- This is a standard SQL comment

it wouldn't hurt to implement it.

---

From: "raminorujov (@raminorujov)" <[email-masked]>
Date: Mon, 14 Jul 2025 16:28:47 +0000

> it wouldn't hurt to implement it.

Ok, will do. Thanks you.

---

From: "raminorujov (@raminorujov)" <[email-masked]>
Date: Tue, 15 Jul 2025 08:27:13 +0000

Hi, @davecramer @vlsi I've implemented line comment parsing in various positions, please, review latest changes. Thanks.

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Wed, 16 Jul 2025 16:41:50 +0000

(on pgjdbc/src/main/java/org/postgresql/core/Parser.java)

Please avoid repeated `toCharArray()` in a loop

---

From: "raminorujov (@raminorujov)" <[email-masked]>
Date: Wed, 16 Jul 2025 16:46:26 +0000

Thanks, good suggestion, refactored.

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Wed, 16 Jul 2025 16:51:11 +0000

@raminorujov , could you factor "whitespace+block comment+line comment" in a method so it could be consistently used when whitespace skip is needed?

---

From: "raminorujov (@raminorujov)" <[email-masked]>
Date: Wed, 16 Jul 2025 16:54:06 +0000

> @raminorujov , could you factor "whitespace+block comment+line comment" in a method so it could be consistently used when whitespace skip is needed?

Sure, will do.