Package org.apache.calcite.sql.dialect
Class PostgresqlSqlDialect
java.lang.Object
org.apache.calcite.sql.SqlDialect
org.apache.calcite.sql.dialect.PostgresqlSqlDialect
A
SqlDialect
implementation for the PostgreSQL database.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.calcite.sql.SqlDialect
SqlDialect.CalendarPolicy, SqlDialect.Context, SqlDialect.DatabaseProduct, SqlDialect.FakeUtil
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SqlDialect
static final SqlDialect.Context
static final RelDataTypeSystem
PostgreSQL type system.Fields inherited from class org.apache.calcite.sql.SqlDialect
BUILT_IN_OPERATORS_LIST, EMPTY_CONTEXT, identifierEndQuoteString, identifierEscapedQuote, identifierQuoteString, literalEndQuoteString, literalEscapedQuote, literalQuoteString, LOGGER, nullCollation
-
Constructor Summary
ConstructorsConstructorDescriptionPostgresqlSqlDialect
(SqlDialect.Context context) Creates a PostgresqlSqlDialect. -
Method Summary
Modifier and TypeMethodDescription@Nullable SqlNode
getCastSpec
(RelDataType type) Returns SqlNode for type in "cast(column as type)", which might be different between databases by type name, precision etc.boolean
Whether a sub-query in the FROM clause must have an alias.boolean
Returns whether the dialect supports character set names as part of a data type, for instanceVARCHAR(30) CHARACTER SET `ISO-8859-1`
.boolean
supportsFunction
(SqlOperator operator, RelDataType type, List<RelDataType> paramTypes) Returns whether this dialect supports a given function or operator.boolean
Returns whether the dialect supports GROUP BY literals.boolean
Returns whether the dialect supports nested aggregations, for instanceSELECT SUM(SUM(1))
.void
unparseCall
(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) Methods inherited from class org.apache.calcite.sql.SqlDialect
allowsAs, configureParser, configureParser, containsNonAscii, create, defaultNullDirection, emulateJoinTypeForCrossJoin, emulateNullDirection, emulateNullDirectionWithIsNull, getCalendarPolicy, getConformance, getDatabaseProduct, getFormatModel, getNullCollation, getProduct, getQuotedCasing, getQuoting, getSingleRowTableName, getTypeSystem, getUnquotedCasing, hasImplicitTableAlias, identifierNeedsQuote, isCaseSensitive, quoteIdentifier, quoteIdentifier, quoteIdentifier, quoteStringLiteral, quoteStringLiteral, quoteStringLiteralUnicode, quoteTimestampLiteral, rewriteSingleValueExpr, supportsAggregateFunction, supportsAggregateFunctionFilter, supportsAliasedValues, supportsApproxCountDistinct, supportsDataType, supportsGroupByWithCube, supportsGroupByWithRollup, supportsImplicitTypeCoercion, supportsJoinType, supportsOffsetFetch, supportsWindowFunctions, unparseDateTimeLiteral, unparseFetchUsingAnsi, unparseFetchUsingLimit, unparseLimit, unparseOffset, unparseOffsetFetch, unparseSqlDatetimeArithmetic, unparseSqlIntervalLiteral, unparseSqlIntervalQualifier, unparseTableScanHints, unparseTopN, unquoteStringLiteral
-
Field Details
-
POSTGRESQL_TYPE_SYSTEM
PostgreSQL type system. -
DEFAULT_CONTEXT
-
DEFAULT
-
-
Constructor Details
-
PostgresqlSqlDialect
Creates a PostgresqlSqlDialect.
-
-
Method Details
-
supportsCharSet
public boolean supportsCharSet()Description copied from class:SqlDialect
Returns whether the dialect supports character set names as part of a data type, for instanceVARCHAR(30) CHARACTER SET `ISO-8859-1`
.- Overrides:
supportsCharSet
in classSqlDialect
-
getCastSpec
Description copied from class:SqlDialect
Returns SqlNode for type in "cast(column as type)", which might be different between databases by type name, precision etc.If this method returns null, the cast will be omitted. In the default implementation, this is the case for the NULL type, and therefore
CAST(NULL AS <nulltype>)
is rendered asNULL
.- Overrides:
getCastSpec
in classSqlDialect
-
supportsFunction
public boolean supportsFunction(SqlOperator operator, RelDataType type, List<RelDataType> paramTypes) Description copied from class:SqlDialect
Returns whether this dialect supports a given function or operator. It only applies to built-in scalar functions and operators, since user-defined functions and procedures should be read by JdbcSchema.- Overrides:
supportsFunction
in classSqlDialect
-
requiresAliasForFromItems
public boolean requiresAliasForFromItems()Description copied from class:SqlDialect
Whether a sub-query in the FROM clause must have an alias.For example, in PostgreSQL, this query is legal:
SELECT * FROM (SELECT * FROM Emp) As e
but remove the alias
e
and it is not:SELECT * FROM (SELECT * FROM Emp)
In Oracle, both queries are legal.
- Overrides:
requiresAliasForFromItems
in classSqlDialect
-
supportsNestedAggregations
public boolean supportsNestedAggregations()Description copied from class:SqlDialect
Returns whether the dialect supports nested aggregations, for instanceSELECT SUM(SUM(1))
.- Overrides:
supportsNestedAggregations
in classSqlDialect
-
unparseCall
- Overrides:
unparseCall
in classSqlDialect
-
supportsGroupByLiteral
public boolean supportsGroupByLiteral()Description copied from class:SqlDialect
Returns whether the dialect supports GROUP BY literals.For instance, in
SqlDialect.DatabaseProduct.REDSHIFT
, the following queries are illegal.select avg(salary) from emp group by true
select avg(salary) from emp group by 'a', DATE '2022-01-01'
- Overrides:
supportsGroupByLiteral
in classSqlDialect
-