# 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.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.GenerateProjection(SelectExpression)
  QuerySqlGenerator.GenerateFrom(SelectExpression)
  QuerySqlGenerator.GenerateOrderings(SelectExpression)
  QuerySqlGenerator.VisitCrossJoin(CrossJoinExpression)
  QuerySqlGenerator.VisitInnerJoin(InnerJoinExpression)
  QuerySqlGenerator.VisitLeftJoin(LeftJoinExpression)
  QuerySqlGenerator.VisitRightJoin(RightJoinExpression)
  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 SQL for the LIMIT/OFFSET clauses of the given SELECT expression.

    protected override void GenerateLimitOffset(SelectExpression selectExpression)

#### Parameters

`selectExpression` SelectExpression

  The SelectExpression for whose LIMIT/OFFSET clauses to generate SQL.

### 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 SQL for the TOP clause of the given SELECT expression.

    protected override void GenerateTop(SelectExpression selectExpression)

#### Parameters

`selectExpression` SelectExpression

  The SelectExpression for whose TOP clause to generate SQL.

### 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 the 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, 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 virtual Expression VisitILike(PgILikeExpression likeExpression, bool negated = false)

#### Parameters

`likeExpression` PgILikeExpression
`negated` bool

#### Returns

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)

Generates SQL for a single ordering in a SELECT ORDER BY clause.

    protected override Expression VisitOrdering(OrderingExpression ordering)

#### Parameters

`ordering` OrderingExpression

#### Returns

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, bool)

Produces SQL for PostgreSQL regex matching.

    protected virtual Expression VisitRegexMatch(PgRegexMatchExpression expression, bool negated = false)

#### Parameters

`expression` PgRegexMatchExpression
`negated` bool

#### Returns

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)

Generates SQL for a binary expression.

    protected override Expression VisitSqlBinary(SqlBinaryExpression binary)

#### Parameters

`binary` SqlBinaryExpression

#### Returns

Expression

### VisitSqlConstant(SqlConstantExpression)

Generates SQL for a constant.

    protected override Expression VisitSqlConstant(SqlConstantExpression sqlConstantExpression)

#### Parameters

`sqlConstantExpression` SqlConstantExpression

  The SqlConstantExpression for which to generate SQL.

#### Returns

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