Subject: [pgjdbc/pgjdbc] PR #3921: Support test.url.* properties in osgi tests

From: "yamert89 (@yamert89)" <[email-masked]>
Date: Fri, 30 Jan 2026 18:46:22 +0000

I wanted to start contributing to this repository, and the first issue I faced was two test failures when using a non-standard  Postgres port. I believe this is a bug and suggest a patch for it.

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Sat, 31 Jan 2026 10:57:04 +0000

are you aware you can create a file build.local.properties and set non-standard ports ?
https://github.com/pgjdbc/pgjdbc/blob/3fab588d93ae4cfeb13f75ba08894b804b256d51/build.properties#L2

---

From: "yamert89 (@yamert89)" <[email-masked]>
Date: Sat, 31 Jan 2026 17:24:26 +0000

@davecramer of course. 
This is my **build.local.properties**
```
test.url.PGHOST=localhost
test.url.PGPORT=7777
secondaryServer1=localhost
secondaryPort1=7778
secondaryServer2=localhost
secondaryPort2=7779
test.url.PGDBNAME=test
user=test
password=test
privilegedUser=postgres
privilegedPassword=
sspiusername=testsspi
preparethreshold=5
sslpassword=sslpwd
```
and  **docker-compose.yml**
```
services:
  pgdb:
    image: postgres:${PGV:-latest}
    ports:
      - 7777:5432
      - 7778:5433
      - 7779:5434
      ...
```

When I run the tests, I get:

```
FATAL: role "test" does not exist
org.postgresql.util.PSQLException: FATAL: role "test" does not exist
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2875)
	at org.postgresql.core.v3.QueryExecutorImpl.readStartupMessages(QueryExecutorImpl.java:3000)
	at org.postgresql.core.v3.QueryExecutorImpl.<init>(QueryExecutorImpl.java:235)
	at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:344)
	at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:57)
	at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:290)
	at org.postgresql.Driver.makeConnection(Driver.java:448)
	at org.postgresql.Driver.connect(Driver.java:298)
	at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:683)
	at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:230)
	at org.postgresql.ds.common.BaseDataSource.getConnection(BaseDataSource.java:104)
	at org.postgresql.xa.PGXADataSource.getXAConnection(PGXADataSource.java:52)
	at org.postgresql.xa.PGXADataSource.getXAConnection(PGXADataSource.java:37)
	at org.postgresql.test.osgi.DataSourceFactoryTest.createXADataSource(DataSourceFactoryTest.java:96)
```
This happens because `DataSourceFactoryTest.getProperties()` drops any non-standard properties.

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Sat, 31 Jan 2026 18:41:28 +0000

looks more to me like there is no user named test

---

From: "yamert89 (@yamert89)" <[email-masked]>
Date: Sat, 31 Jan 2026 19:19:17 +0000

```
yamert89@pc:~/workspace/projects/pgjdbc/docker/postgres-server$ PGV=17 SSL=no XA=yes SCRAM=yes docker compose up -d
[+] Running 2/2
 ✔ Network postgres-server_default   Created                                                                                                                                                                                     0.0s 
 ✔ Container postgres-server-pgdb-1  Started                                                                                                                                                                                     0.2s 
 
 yamert89@pc:~/workspace/projects/pgjdbc/docker/postgres-server$ docker inspect postgres-server-pgdb-1 | grep HostPort
                        "HostPort": "7777"
                        "HostPort": "7778"
                        "HostPort": "7779"
                        "HostPort": "7777"
                        "HostPort": "7777"
                        "HostPort": "7778"
                        "HostPort": "7778"
                        "HostPort": "7779"
                        "HostPort": "7779"
                        
yamert89@pc:~/workspace/projects/pgjdbc/docker/postgres-server$ docker exec -it postgres-server-pgdb-1 psql -U postgres
psql (17.5 (Debian 17.5-1.pgdg120+1))
Type "help" for help.

postgres=# SELECT 
    datname,
    has_database_privilege('test', oid, 'CONNECT') as connect,
    has_database_privilege('test', oid, 'CREATE') as create 
FROM pg_database                                            
WHERE datname = 'test';
 datname | connect | create 
---------+---------+--------
 test    | t       | t
(1 row)
```

---

From: "yamert89 (@yamert89)" <[email-masked]>
Date: Sat, 31 Jan 2026 19:33:38 +0000

```
private static Properties getProperties() {
    Properties p = loadPropertyFiles("build.properties");
    p.putAll(System.getProperties());
    Properties p2 = new Properties();
    for (Map.Entry<Object, Object> entry : p.entrySet()) {
     if (PGProperty.forName((String) entry.getKey()) != null) {  // This line drops all non-standard properties
        p2.put(entry.getKey(), entry.getValue());
      }
    }
    return p2;
  }
```

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Sat, 31 Jan 2026 21:10:48 +0000

Is there a user named test ? Can you connect as test ?