public class CreateIndex extends PostgresSqlPart

Generates a CREATE INDEX statement for PostgreSQL.


Sample Generated SQL:

CREATE UNIQUE INDEX "idx_firstname_lastname" ON "person" ("firstname", "lastname");
  • Constructor Details

    • CreateIndex

      public CreateIndex()
    • CreateIndex

      public CreateIndex(String indexName, String tableName, String... columnNames)
  • Method Details

    • setPretty

      public CreateIndex setPretty(boolean pretty)
      Description copied from class: SqlPart
      Indicates if SqlPart.getSqlFragment() adds line breaks and indentation instead of using one line (default is false).
      Overrides:
      setPretty in class SqlPart
    • collectSqlFragment

      public void collectSqlFragment(CodeWriter writer)
      Description copied from class: SqlPart
      Writes this part's SQL to the writer; used by SqlPart.getSqlFragment() and by enclosing parts.
      Specified by:
      collectSqlFragment in class SqlPart
    • getIndexName

      public String getIndexName()
    • setIndexName

      public CreateIndex setIndexName(String indexName)
    • getTableName

      public String getTableName()
    • setTableName

      public CreateIndex setTableName(String tableName)
    • getColumnNames

      public List<String> getColumnNames()
    • setColumnNames

      public CreateIndex setColumnNames(List<String> columnNames)
    • setColumnNames

      public CreateIndex setColumnNames(String... columnNames)
    • isUnique

      public boolean isUnique()
    • setUnique

      public CreateIndex setUnique(boolean unique)
    • isCheckIfNotExists

      public boolean isCheckIfNotExists()
      Indicates if IF NOT EXISTS clause should be included in the CREATE INDEX statement (default true).
    • setCheckIfNotExists

      public CreateIndex setCheckIfNotExists(boolean checkIfNotExists)
      Indicates if IF NOT EXISTS clause should be included in the CREATE INDEX statement (default true).