Subject: [pgjdbc/pgjdbc] issue #753: Implement a connection property to add SQL text and bind values to PSQLException

From: "vlsi (@vlsi)" <[email-masked]>
Date: Sat, 18 Feb 2017 17:40:28 +0000

Currently pgjdbc does not put SQL text to the error messages.
That makes debugging harder.

It would be nice if pgjdbc could just add SQL text.

Note: SQL text and bind variables might impose a security risk (e.g. SQL exceptions might be displayed to the end-user by mistake), so the feature should probably be disabled by default.

---

From: "Shanayshah44 (@Shanayshah44)" <[email-masked]>
Date: Wed, 25 Dec 2024 11:21:52 +0000

We can solve this by maintaining a map of properties, where we include a boolean property specifically for controlling whether the SQL text and bind variables should be included in error messages. By default, this property would be set to false, and we could manage it based on the setting or configuration, allowing it to be enabled or disabled as needed. This approach provides flexibility while keeping the feature disabled by default for security reasons.

---

From: "Shanayshah44 (@Shanayshah44)" <[email-masked]>
Date: Sat, 28 Dec 2024 04:26:29 +0000

Let me know if the approach is right or wrong?

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Sat, 28 Dec 2024 11:31:24 +0000

Yes, to property, We don't use a map of them though.

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Sat, 28 Dec 2024 11:37:37 +0000

If we add such a connection property, then it might be considered a CVE. For instance, we had to remove a property for log configuration.

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Sat, 28 Dec 2024 11:49:30 +0000

The log configuration was for creating a file. 
Is there a way to configure it using logging configuration ? Can you for instance provide a class in the logging configuration which would be loaded if someone were to change the configuration ?

Otherwise, I don't see a way to do this.