AuroraDbStatementBuilder

A class used to build the SQL statements for Aurora PostgreSQL.

This class is the BaseStatementBuilder-derived implementation for Aurora PostgreSQL. It is automatically registered by AuroraDbBootstrap — you do not need to instantiate it directly under normal use.

Constructors

public AuroraDbStatementBuilder()
public AuroraDbStatementBuilder(IDbSetting dbSetting,
    IResolver<Field, IDbSetting, string> convertFieldResolver = null,
    IResolver<Type, Type> averageableClientTypeResolver = null)

The parameterless constructor defaults convertFieldResolver to AuroraDbConvertFieldResolver.

Aurora PostgreSQL-specific generation notes

  • Paging uses LIMIT/LIMIT ... OFFSET for Query/top-N queries and BatchQuery/skip-take queries.
  • Insert appends a trailing RETURNING ... AS "Result" clause so the generated/primary key is returned in the same round trip, casting it to its SQL type first when one can be resolved.
  • InsertAll builds a single multi-row INSERT ... VALUES (...), (...), ... with one trailing RETURNING clause for the whole batch — this assumes the returned rows come back in the same order the rows were listed, which has not been independently verified against an Aurora cluster.
  • Merge/MergeAll compile to INSERT ... ON CONFLICT (qualifiers) DO UPDATE SET ..., each with a trailing RETURNING clause (MergeAll also returns a per-row __RepoDb_OrderColumn parameter alongside the key, to align results back to the source rows). An identity column is inserted with OVERRIDING SYSTEM VALUE so an explicit value on the entity is respected instead of silently ignored.
  • Truncate is TRUNCATE TABLE ... RESTART IDENTITY.
  • Passing a non-null hints argument to any Create* method throws NotSupportedException, since AuroraDbDbSetting.AreTableHintsSupported is false.

Aurora PostgreSQL is PostgreSQL-compatible, so the generated SQL matches RepoDb.PostgreSql rather than RepoDb.CockroachDb — in particular, Truncate restarts the identity sequence here, while CockroachDB’s does not.

Usability

Use StatementBuilderMapper to override it with a custom implementation.

StatementBuilderMapper.Add(typeof(AuroraDbConnection), new MyCustomAuroraDbStatementBuilder(dbSetting), true);