Class PostgreSQLTranslator

java.lang.Object
adql.translator.JDBCTranslator
adql.translator.PostgreSQLTranslator
All Implemented Interfaces:
ADQLTranslator
Direct Known Subclasses:
PgSphereTranslator

public class PostgreSQLTranslator extends JDBCTranslator
Translates all ADQL objects into an SQL interrogation query designed for PostgreSQL.

It overwrites the translation of mathematical functions whose some have a different name or signature. Besides, it is also implementing the translation of the geometrical functions. However, it does not really translate them. It is just returning the ADQL expression (by calling JDBCTranslator.getDefaultADQLFunction(ADQLFunction)). And so, of course, the execution of a SQL query containing geometrical functions and translated using this translator will not work. It is just a default implementation in case there is no interest of these geometrical functions.

Important note 1: The geometrical functions and IN_UNIT are translated exactly as in ADQL. You will probably need to extend this translator to correctly manage the geometrical functions. An extension is already available for PgSphere: PgSphereTranslator.

Important note 2: If new optional features are supported in an extension of this translator, they should be visible in getSupportedFeatures(). To customize this list, you must overwrite initSupportedFeatures() and update in there the attribute supportedFeatures.

See Also:
  • Field Details

    • caseSensitivity

      protected byte caseSensitivity

      Indicate the case sensitivity to apply to each SQL identifier (only SCHEMA, TABLE and COLUMN).

      Note: In this implementation, this field is set by the constructor and never modified elsewhere. It would be better to never modify it after the construction in order to keep a certain consistency.

    • supportedFeatures

      protected final FeatureSet supportedFeatures
      List of all optional features supported by this translator.

      Note: This list can be customized by extending this translator and then overwriting initSupportedFeatures().

      Since:
      2.0
  • Constructor Details

    • PostgreSQLTranslator

      public PostgreSQLTranslator()
      Builds a PostgreSQLTranslator which always translates in SQL all identifiers (schema, table and column) in a case sensitive manner ; in other words, schema, table and column names will be surrounded by double quotes in the SQL translation.
    • PostgreSQLTranslator

      public PostgreSQLTranslator(boolean allCaseSensitive)
      Builds a PostgreSQLTranslator which always translates in SQL all identifiers (schema, table and column) in the specified case sensitivity ; in other words, schema, table and column names will all be surrounded or not by double quotes in the SQL translation.
      Parameters:
      allCaseSensitive - true to translate all identifiers in a case sensitive manner (surrounded by double quotes), false for case insensitivity.
    • PostgreSQLTranslator

      public PostgreSQLTranslator(boolean catalog, boolean schema, boolean table, boolean column)
      Builds a PostgreSQLTranslator which will always translate in SQL identifiers with the defined case sensitivity.
      Parameters:
      catalog - true to translate catalog names with double quotes (case sensitive in the DBMS), false otherwise.
      schema - true to translate schema names with double quotes (case sensitive in the DBMS), false otherwise.
      table - true to translate table names with double quotes (case sensitive in the DBMS), false otherwise.
      column - true to translate column names with double quotes (case sensitive in the DBMS), false otherwise.
  • Method Details