Message-ID: From: "davecramer (@davecramer)" To: "pgjdbc/pgjdbc" Date: Mon, 18 Aug 2025 19:07:26 +0000 Subject: Re: [pgjdbc/pgjdbc] PR #3762: Fix: BaseDataSource.getProperty mirrors BaseDataSource.setProperty. In-Reply-To: References: List-Id: X-GitHub-Author-Login: davecramer X-GitHub-Comment-Id: 3198077230 X-GitHub-Comment-Type: issue_comment X-GitHub-Issue: 3762 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/pull/3762#issuecomment-3198077230 Content-Type: text/plain; charset=utf-8 > I've been pondering how `setService(String)` interacts with `getUrl()` and `setUrl(String)`. > > After setting a service the URL looks like this: > > `jdbc:postgresql://localhost/?service=test-service1` > > If you call `setUrl` with this value it sets all the properties values from the service including defaults. Something like this: > > `jdbc:postgresql://localhost:5432/test_dbname?adaptiveFetch=false&...&useSpnego=false&xmlFactoryFactory=` > > Everything is set _except_ for `service`. > > Is the correct and expected behaviour: > > 1. Just like this - this is perfect > 2. Calling `setService(String)` should set all the property values for the service, so the first URL should have them all set. > 3. Calling getUrl() should never include a "service=" element as it is non-portable. > 4. Calling setUrl() should preserve the service property. > > Personally, I would like `setService` to load the service defaults, and the non-portable "service=" value in the URL to be removed. I guess there is no reason not to load the settings when setService is called. If however someone calls setUrl with a different service we should honour the settings for that service.