Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose parameter status messages (GUC_REPORT) to the user #1435

Merged
merged 2 commits into from
Jul 5, 2019

Commits on Mar 27, 2019

  1. Attempt to make StatementTest.testShortQueryTimeout() more reliable

    I'm observing intermittent failures like:
    
        testShortQueryTimeout(org.postgresql.test.jdbc2.StatementTest)  Time elapsed: 0.219 sec  <<< ERROR!
        org.postgresql.util.PSQLException: ERROR: canceling statement due to user request
    
    The cause of that isn't yet clear. But I noticed that the test doesn't check
    for the SQLSTATE of the expected exception, so fix that.
    ringerc committed Mar 27, 2019
    Configuration menu
    Copy the full SHA
    5b2f6b8 View commit details
    Browse the repository at this point in the history
  2. Expose parameter status messages (GUC_REPORT) to the user

    Add a new `Map PGConnection.getParameterStatuses()` method that tracks the
    latest values of all `GUC_REPORT` parameters reported by the server in
    `ParameterStatus` protocol messages from the server. The map is read-only. A
    convenience `PGConnection.getParameterStatus(String)` wrapper is also provided.
    
    This provides a PgJDBC equivalent to the `PQparameterStatus(...)` `libpq` API
    function.
    
    Extensions may define custom GUCs that are set as `GUC_REPORT` when they
    `DefineCustomStringVariable(...)` etc. This feature will properly handle such
    GUCs, allowing applications to generate parameter status change messages in
    their extensions and have them available to the JDBC driver without needing
    round trips.
    
    No assumptions are made about which server GUCs are `GUC_REPORT` or their
    names, so it'll work (with possible test case tweaks) on current and future
    server versions.
    
    Github issue pgjdbc#1428
    ringerc committed Mar 27, 2019
    Configuration menu
    Copy the full SHA
    4ccff98 View commit details
    Browse the repository at this point in the history