pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
[pgjdbc/pgjdbc] issue #3798: getNotifications() behavior does not match documentation
4+ messages / 2 participants
[nested] [flat]

* [pgjdbc/pgjdbc] issue #3798: getNotifications() behavior does not match documentation
@ 2025-09-16 15:23  "pdewacht (@pdewacht)" <[email protected]>
  0 siblings, 0 replies; 4+ messages in thread

From: pdewacht (@pdewacht) @ 2025-09-16 15:23 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

The two variants of the `PGNotification.getNotifications()` method are documented to return null if there are no notifications: https://github.com/pgjdbc/pgjdbc/blob/a3be9d5ec7efe18e88e44f1637c459eb2bb4cc15/pgjdbc/src/main/java/...

In fact they return an empty array. 

It seems the code to implement the 'return null' behavior was unintentionally removed in [529e5dc3a](https://github.com/pgjdbc/pgjdbc/commit/529e5dc3a8f071ad4946daf3bde1422c21a99524#diff-8ee30bec696495...).


Since this has been broken for a while, it might be better to just update the documentation to match the current behavior.

**Driver Version?** 

42.7.7

**To Reproduce**

```
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Properties;
import org.postgresql.PGConnection;

public class TestGetNotificationsNullResult {
    public static void main(String []args) throws Exception {
        String url = "jdbc:postgresql://localhost:5432/test";
        Properties props = new Properties();
        props.setProperty("user", "test");
        props.setProperty("password", "test");
        try (Connection conn = DriverManager.getConnection(url, props)) {
            var notifications = conn.unwrap(PGConnection.class).getNotifications();
            System.out.println("Expecting null: " + notifications);
        }
    }
}

```


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #3798: getNotifications() behavior does not match documentation
@ 2025-09-16 18:25  "davecramer (@davecramer)" <[email protected]>
  2 siblings, 0 replies; 4+ messages in thread

From: davecramer (@davecramer) @ 2025-09-16 18:25 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

could you provide a PR ?

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #3798: getNotifications() behavior does not match documentation
@ 2025-09-16 18:59  "pdewacht (@pdewacht)" <[email protected]>
  2 siblings, 0 replies; 4+ messages in thread

From: pdewacht (@pdewacht) @ 2025-09-16 18:59 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

A PR to fix the documentation, or a PR to fix the code? Either way is fine for me.

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #3798: getNotifications() behavior does not match documentation
@ 2025-09-16 19:20  "davecramer (@davecramer)" <[email protected]>
  2 siblings, 0 replies; 4+ messages in thread

From: davecramer (@davecramer) @ 2025-09-16 19:20 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

Documentation, as you say it's been like that for a while.

^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2025-09-16 19:20 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-09-16 15:23 [pgjdbc/pgjdbc] issue #3798: getNotifications() behavior does not match documentation "pdewacht (@pdewacht)" <[email protected]>
2025-09-16 18:25 ` "davecramer (@davecramer)" <[email protected]>
2025-09-16 18:59 ` "pdewacht (@pdewacht)" <[email protected]>
2025-09-16 19:20 ` "davecramer (@davecramer)" <[email protected]>

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