Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-3048

Improve how JDBC adapter deduces current schema on Redshift

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.20.0
    • Component/s: None
    • Labels:
      None

      Description

      Improve how JDBC adapter deduces current schema on Amazon Redshift or PostgreSQL. Until now, we either look at the schema connect-string parameter, or call Connection.getSchema() (on JDBC 4.1 and above). But in Redshift's JDBC driver, Connection.getSchema() always returns null.

      Now, if we know we are running against Redshift or PostgreSQL, we will execute a select current_schema() query to find the current schema.

      Similarly for Connection.getCatalog() and select current_database().

      Without this fix, we sometimes call DatabaseMetaData.getTables with null or empty schema, and get tables from other schemas, resulting in a "Multiple entries with same key" error while populating a Guava ImmutableMap.

        Attachments

          Activity

            People

            • Assignee:
              julianhyde Julian Hyde
              Reporter:
              julianhyde Julian Hyde
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: