# Class NpgsqlQuerySqlGenerator

Namespace
  Npgsql.EntityFrameworkCore.PostgreSQL.Query.Internal

Assembly
  Npgsql.EntityFrameworkCore.PostgreSQL.dll

The default query SQL generator for Npgsql.

    public class NpgsqlQuerySqlGenerator : QuerySqlGenerator

Inheritance
  object
  ExpressionVisitor
  SqlExpressionVisitor
  QuerySqlGenerator
  NpgsqlQuerySqlGenerator

Inherited Members
  QuerySqlGenerator.GetCommand(Expression)
  QuerySqlGenerator.GenerateTagsHeaderComment(SelectExpression)
  QuerySqlGenerator.GenerateTagsHeaderComment(ISet<string>)
  QuerySqlGenerator.VisitSqlFragment(SqlFragmentExpression)
  QuerySqlGenerator.VisitSelect(SelectExpression)
  QuerySqlGenerator.GeneratePseudoFromClause()
  QuerySqlGenerator.GenerateEmptyProjection(SelectExpression)
  QuerySqlGenerator.VisitProjection(ProjectionExpression)
  QuerySqlGenerator.VisitSqlFunction(SqlFunctionExpression)
  QuerySqlGenerator.VisitTableValuedFunction(TableValuedFunctionExpression)
  QuerySqlGenerator.VisitColumn(ColumnExpression)
  QuerySqlGenerator.VisitTable(TableExpression)
  QuerySqlGenerator.VisitFromSql(FromSqlExpression)
  QuerySqlGenerator.CheckComposableSql(string)
  QuerySqlGenerator.CheckComposableSqlTrimmed(ReadOnlySpan<char>)
  QuerySqlGenerator.VisitSqlConstant(SqlConstantExpression)
  QuerySqlGenerator.VisitSqlParameter(SqlParameterExpression)
  QuerySqlGenerator.VisitLike(LikeExpression)
  QuerySqlGenerator.GenerateLike(LikeExpression, bool)
  QuerySqlGenerator.VisitDistinct(DistinctExpression)
  QuerySqlGenerator.VisitCase(CaseExpression)
  QuerySqlGenerator.VisitExists(ExistsExpression)
  QuerySqlGenerator.GenerateExists(ExistsExpression, bool)
  QuerySqlGenerator.VisitIn(InExpression)
  QuerySqlGenerator.GenerateIn(InExpression, bool)
  QuerySqlGenerator.VisitAtTimeZone(AtTimeZoneExpression)
  QuerySqlGenerator.GenerateOrderings(SelectExpression)
  QuerySqlGenerator.VisitCrossJoin(CrossJoinExpression)
  QuerySqlGenerator.VisitInnerJoin(InnerJoinExpression)
  QuerySqlGenerator.VisitLeftJoin(LeftJoinExpression)
  QuerySqlGenerator.VisitScalarSubquery(ScalarSubqueryExpression)
  QuerySqlGenerator.VisitRowNumber(RowNumberExpression)
  QuerySqlGenerator.VisitRowValue(RowValueExpression)
  QuerySqlGenerator.VisitExcept(ExceptExpression)
  QuerySqlGenerator.VisitIntersect(IntersectExpression)
  QuerySqlGenerator.VisitUnion(UnionExpression)
  QuerySqlGenerator.Dependencies
  QuerySqlGenerator.AliasSeparator
  QuerySqlGenerator.Sql
  ExpressionVisitor.Visit(ReadOnlyCollection<Expression>)
  ExpressionVisitor.Visit(Expression)
  ExpressionVisitor.VisitAndConvert<T>(ReadOnlyCollection<T>, string)
  ExpressionVisitor.VisitAndConvert<T>(T, string)
  ExpressionVisitor.VisitBinary(BinaryExpression)
  ExpressionVisitor.VisitBlock(BlockExpression)
  ExpressionVisitor.VisitCatchBlock(CatchBlock)
  ExpressionVisitor.VisitConditional(ConditionalExpression)
  ExpressionVisitor.VisitConstant(ConstantExpression)
  ExpressionVisitor.VisitDebugInfo(DebugInfoExpression)
  ExpressionVisitor.VisitDefault(DefaultExpression)
  ExpressionVisitor.VisitDynamic(DynamicExpression)
  ExpressionVisitor.VisitElementInit(ElementInit)
  ExpressionVisitor.VisitGoto(GotoExpression)
  ExpressionVisitor.VisitIndex(IndexExpression)
  ExpressionVisitor.VisitInvocation(InvocationExpression)
  ExpressionVisitor.VisitLabel(LabelExpression)
  ExpressionVisitor.VisitLabelTarget(LabelTarget)
  ExpressionVisitor.VisitLambda<T>(Expression<T>)
  ExpressionVisitor.VisitListInit(ListInitExpression)
  ExpressionVisitor.VisitLoop(LoopExpression)
  ExpressionVisitor.VisitMember(MemberExpression)
  ExpressionVisitor.VisitMemberAssignment(MemberAssignment)
  ExpressionVisitor.VisitMemberBinding(MemberBinding)
  ExpressionVisitor.VisitMemberInit(MemberInitExpression)
  ExpressionVisitor.VisitMemberListBinding(MemberListBinding)
  ExpressionVisitor.VisitMemberMemberBinding(MemberMemberBinding)
  ExpressionVisitor.VisitMethodCall(MethodCallExpression)
  ExpressionVisitor.VisitNew(NewExpression)
  ExpressionVisitor.VisitNewArray(NewArrayExpression)
  ExpressionVisitor.VisitParameter(ParameterExpression)
  ExpressionVisitor.VisitRuntimeVariables(RuntimeVariablesExpression)
  ExpressionVisitor.VisitSwitch(SwitchExpression)
  ExpressionVisitor.VisitSwitchCase(SwitchCase)
  ExpressionVisitor.VisitTry(TryExpression)
  ExpressionVisitor.VisitTypeBinary(TypeBinaryExpression)
  ExpressionVisitor.VisitUnary(UnaryExpression)
  ExpressionVisitor.Visit<T>(ReadOnlyCollection<T>, Func<T, T>)
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.MemberwiseClone()
  object.ReferenceEquals(object, object)
  object.ToString()

## Constructors

### NpgsqlQuerySqlGenerator(QuerySqlGeneratorDependencies, IRelationalTypeMappingSource, bool, Version)

    public NpgsqlQuerySqlGenerator(QuerySqlGeneratorDependencies dependencies, IRelationalTypeMappingSource typeMappingSource, bool reverseNullOrderingEnabled, Version postgresVersion)

#### Parameters

`dependencies` QuerySqlGeneratorDependencies
`typeMappingSource` IRelationalTypeMappingSource
`reverseNullOrderingEnabled` bool
`postgresVersion` Version

## Methods

### GenerateLimitOffset(SelectExpression)

Generates a LIMIT...OFFSET... construct in the relational command

    protected override void GenerateLimitOffset(SelectExpression selectExpression)

#### Parameters

`selectExpression` SelectExpression

  A select expression to use.

### GenerateRootCommand(Expression)

Generates the command for the given top-level query expression. This allows providers to intercept if an expression requires different processing when it is at top-level.

    protected override void GenerateRootCommand(Expression queryExpression)

#### Parameters

`queryExpression` Expression

  A query expression to print in command.

### GenerateSetOperation(SetOperationBase)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    protected override void GenerateSetOperation(SetOperationBase setOperation)

#### Parameters

`setOperation` SetOperationBase

### GenerateSetOperationOperand(SetOperationBase, SelectExpression)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    protected override void GenerateSetOperationOperand(SetOperationBase setOperation, SelectExpression operand)

#### Parameters

`setOperation` SetOperationBase
`operand` SelectExpression

### GenerateTop(SelectExpression)

Generates a TOP construct in the relational command

    protected override void GenerateTop(SelectExpression selectExpression)

#### Parameters

`selectExpression` SelectExpression

  A select expression to use.

### GenerateValues(ValuesExpression)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    protected override void GenerateValues(ValuesExpression valuesExpression)

#### Parameters

`valuesExpression` ValuesExpression

### GetOperator(SqlBinaryExpression)

Gets a SQL operator for a SQL binary operation.

    protected override string GetOperator(SqlBinaryExpression e)

#### Parameters

`e` SqlBinaryExpression

#### Returns

string

  A string representation of the binary operator.

### RequiresParentheses(SqlExpression, SqlExpression)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    protected override bool RequiresParentheses(SqlExpression outerExpression, SqlExpression innerExpression)

#### Parameters

`outerExpression` SqlExpression
`innerExpression` SqlExpression

#### Returns

bool

### TryGenerateWithoutWrappingSelect(SelectExpression)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    protected override bool TryGenerateWithoutWrappingSelect(SelectExpression selectExpression)

#### Parameters

`selectExpression` SelectExpression

#### Returns

bool

### TryGetOperatorInfo(SqlExpression, out int, out bool)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    protected override bool TryGetOperatorInfo(SqlExpression expression, out int precedence, out bool isAssociative)

#### Parameters

`expression` SqlExpression
`precedence` int
`isAssociative` bool

#### Returns

bool

### VisitArrayAll(PgAllExpression)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    protected virtual Expression VisitArrayAll(PgAllExpression expression)

#### Parameters

`expression` PgAllExpression

#### Returns

Expression

### VisitArrayAny(PgAnyExpression)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    protected virtual Expression VisitArrayAny(PgAnyExpression expression)

#### Parameters

`expression` PgAnyExpression

#### Returns

Expression

### VisitArrayIndex(SqlBinaryExpression)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    protected virtual Expression VisitArrayIndex(SqlBinaryExpression expression)

#### Parameters

`expression` SqlBinaryExpression

#### Returns

Expression

### VisitArrayIndex(PgArrayIndexExpression)

Produces SQL array index expression (e.g. arr[1]).

    protected virtual Expression VisitArrayIndex(PgArrayIndexExpression expression)

#### Parameters

`expression` PgArrayIndexExpression

#### Returns

Expression

### VisitArraySlice(PgArraySliceExpression)

Produces SQL array slice expression (e.g. arr[1:2]).

    protected virtual Expression VisitArraySlice(PgArraySliceExpression expression)

#### Parameters

`expression` PgArraySliceExpression

#### Returns

Expression

### VisitCollate(CollateExpression)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    protected override Expression VisitCollate(CollateExpression collateExpression)

#### Parameters

`collateExpression` CollateExpression

#### Returns

Expression

### VisitCrossApply(CrossApplyExpression)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    protected override Expression VisitCrossApply(CrossApplyExpression crossApplyExpression)

#### Parameters

`crossApplyExpression` CrossApplyExpression

#### Returns

Expression

### VisitDelete(DeleteExpression)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    protected override Expression VisitDelete(DeleteExpression deleteExpression)

#### Parameters

`deleteExpression` DeleteExpression

#### Returns

Expression

### VisitExtension(Expression)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    protected override Expression VisitExtension(Expression extensionExpression)

#### Parameters

`extensionExpression` Expression

#### Returns

Expression

### VisitILike(PgILikeExpression)

Visits the children of an PgILikeExpression.

    protected virtual Expression VisitILike(PgILikeExpression likeExpression)

#### Parameters

`likeExpression` PgILikeExpression

  The expression.

#### Returns

Expression

  An Expression.

### VisitJsonPathTraversal(PgJsonTraversalExpression)

Visits the children of an PgJsonTraversalExpression.

    protected virtual Expression VisitJsonPathTraversal(PgJsonTraversalExpression expression)

#### Parameters

`expression` PgJsonTraversalExpression

  The expression.

#### Returns

Expression

  An Expression.

### VisitJsonScalar(JsonScalarExpression)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    protected override Expression VisitJsonScalar(JsonScalarExpression jsonScalarExpression)

#### Parameters

`jsonScalarExpression` JsonScalarExpression

#### Returns

Expression

### VisitNewArray(PgNewArrayExpression)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    protected virtual Expression VisitNewArray(PgNewArrayExpression pgNewArrayExpression)

#### Parameters

`pgNewArrayExpression` PgNewArrayExpression

#### Returns

Expression

### VisitOrdering(OrderingExpression)

Visits the children of the ordering expression.

    protected override Expression VisitOrdering(OrderingExpression ordering)

#### Parameters

`ordering` OrderingExpression

#### Returns

Expression

  The modified expression, if it or any subexpression was modified; otherwise, returns the original expression.

### VisitOuterApply(OuterApplyExpression)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    protected override Expression VisitOuterApply(OuterApplyExpression outerApplyExpression)

#### Parameters

`outerApplyExpression` OuterApplyExpression

#### Returns

Expression

### VisitPgBinary(PgBinaryExpression)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    protected virtual Expression VisitPgBinary(PgBinaryExpression binaryExpression)

#### Parameters

`binaryExpression` PgBinaryExpression

#### Returns

Expression

### VisitPgDelete(PgDeleteExpression)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    protected virtual Expression VisitPgDelete(PgDeleteExpression pgDeleteExpression)

#### Parameters

`pgDeleteExpression` PgDeleteExpression

#### Returns

Expression

### VisitPgFunction(PgFunctionExpression)

Visits the children of a PgFunctionExpression.

    protected virtual Expression VisitPgFunction(PgFunctionExpression e)

#### Parameters

`e` PgFunctionExpression

  The expression.

#### Returns

Expression

  An Expression.

### VisitPgTableValuedFunctionExpression(PgTableValuedFunctionExpression)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    protected virtual Expression VisitPgTableValuedFunctionExpression(PgTableValuedFunctionExpression tableValuedFunctionExpression)

#### Parameters

`tableValuedFunctionExpression` PgTableValuedFunctionExpression

#### Returns

Expression

### VisitRegexMatch(PgRegexMatchExpression)

Visits the children of a PgRegexMatchExpression.

    protected virtual Expression VisitRegexMatch(PgRegexMatchExpression expression)

#### Parameters

`expression` PgRegexMatchExpression

  The expression.

#### Returns

Expression

  An Expression.

#### Remarks

See: http://www.postgresql.org/docs/current/static/functions-matching.html

### VisitRowValue(PgRowValueExpression)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    protected virtual Expression VisitRowValue(PgRowValueExpression rowValueExpression)

#### Parameters

`rowValueExpression` PgRowValueExpression

#### Returns

Expression

### VisitSqlBinary(SqlBinaryExpression)

Visits the children of the sql binary expression.

    protected override Expression VisitSqlBinary(SqlBinaryExpression binary)

#### Parameters

`binary` SqlBinaryExpression

#### Returns

Expression

  The modified expression, if it or any subexpression was modified; otherwise, returns the original expression.

### VisitSqlUnary(SqlUnaryExpression)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    protected override Expression VisitSqlUnary(SqlUnaryExpression sqlUnaryExpression)

#### Parameters

`sqlUnaryExpression` SqlUnaryExpression

#### Returns

Expression

### VisitUnknownBinary(PgUnknownBinaryExpression)

Visits the children of a PgUnknownBinaryExpression.

    protected virtual Expression VisitUnknownBinary(PgUnknownBinaryExpression unknownBinaryExpression)

#### Parameters

`unknownBinaryExpression` PgUnknownBinaryExpression

  The expression.

#### Returns

Expression

  An Expression.

### VisitUpdate(UpdateExpression)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    protected override Expression VisitUpdate(UpdateExpression updateExpression)

#### Parameters

`updateExpression` UpdateExpression

#### Returns

Expression

### VisitValues(ValuesExpression)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    protected override Expression VisitValues(ValuesExpression valuesExpression)

#### Parameters

`valuesExpression` ValuesExpression

#### Returns

Expression