pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: davecramer (@davecramer) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: Re: [pgjdbc/pgjdbc] PR #3762: Fix: BaseDataSource.getProperty mirrors BaseDataSource.setProperty.
Date: Mon, 18 Aug 2025 19:07:26 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

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

view thread (8+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: github://pgjdbc/pgjdbc
  Cc: [email protected], [email protected]
  Subject: Re: [pgjdbc/pgjdbc] PR #3762: Fix: BaseDataSource.getProperty mirrors BaseDataSource.setProperty.
  In-Reply-To: <<[email protected]>>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox