Class PostgreSqlStatementResolver

java.lang.Object
com.sap.cds.jdbc.generic.GenericStatementResolver
com.sap.cds.jdbc.postgresql.PostgreSqlStatementResolver
All Implemented Interfaces:
StatementResolver

public class PostgreSqlStatementResolver extends GenericStatementResolver
  • Constructor Details

    • PostgreSqlStatementResolver

      public PostgreSqlStatementResolver()
  • Method Details

    • upsert

      public String upsert(String table, Stream<String> keyColumns, Stream<String> upsertColumns, Stream<String> upsertValues)
      PostgreSQL: INSERT INTO with ON CONFLICT DO UPDATE

      ON CONFLICT can be used to specify an alternative action to raising a unique constraint or exclusion constraint violation error. For each individual row proposed for insertion, either the insertion proceeds, or, if an arbiter constraint or index specified by conflict_target is violated, the alternative conflict_action is taken. ON CONFLICT DO UPDATE updates the existing row that conflicts with the row proposed for insertion as its alternative action.

      ON CONFLICT DO UPDATE guarantees an atomic INSERT or UPDATE outcome; provided there is no independent error, one of those two outcomes is guaranteed, even under high concurrency. This is also known as UPSERT — “UPDATE or INSERT”.

      https://www.postgresql.org/docs/current/sql-insert.html#SQL-ON-CONFLICT

    • lockMode

      public String lockMode(CqnLock.Mode mode)
    • timeoutClause

      public Optional<String> timeoutClause(int timeoutSeconds)
    • deleteAll

      public String deleteAll(String tableName)