classReindex
final class Reindex
implements Statement
uses Snapshot
@visibility public.REINDEX: a request to rebuild indexes.
Rule: PG-REINDEX-001. Mirrors PostgreSQL's ReindexStmt (kind, relation or name, params) with the CONCURRENTLY word, which the server turns into the option of that name. An index or a table is named by a relation name, a schema by its name, and SYSTEM or DATABASE by the name of the current database or by nothing. Facts: the table of REINDEX TABLE is resolved; an index, a schema and a database are not part of a declaration context; a table declared as another kind than a table or a materialized view is reported (PG-RELATION-KIND-001). Diagnostics: an option REINDEX does not know; a value the option cannot take; SYSTEM rebuilt concurrently, by the word or by the option. Source: https://www.postgresql.org/docs/17/sql-reindex.html. Status: Implemented.
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('REINDEX (VERBOSE) TABLE CONCURRENTLY app.t');
[$operation->statement->target, $operation->statement->concurrently, $operation->statement->object->name->value] // => [\SqlSemantics\Platform\PostgreSql\Statement\Utility\Maintenance\ReindexTarget::Table, true, 't']new \SqlSemantics\Platform\PostgreSql\Statement\Utility\Maintenance\Reindex(\SqlSemantics\Platform\PostgreSql\Statement\Utility\Maintenance\ReindexTarget::Schema, new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\QualifiedName(new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('s'))) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstructionProperties§
public list<UtilityOption> $optionspublic ReindexTarget $targetpublic QualifiedName|Name|null $objectpublic bool $concurrently = falseMethods§
public function __construct(
public ReindexTarget $target,
public QualifiedName|Name|null $object,
list<UtilityOption> $options = [],
public bool $concurrently = false,
)Parameters
$target | ReindexTarget | What is rebuilt |
$object | QualifiedName|Name|null | The relation name of an index or table, the name of a schema, or the optional name of the database |
$options | list<UtilityOption> | The parenthesized options in the order written |
$concurrently | bool | Whether CONCURRENTLY is written |
Calls 8
- static-call Check::listOf() line 68
- class-const UtilityOption::class() line 68
- static-call Check::input() line 69
- class-const ReindexTarget::Index() line 70
- class-const ReindexTarget::Table() line 70
- class-const ReindexTarget::Schema() line 71
- class-const ReindexTarget::System() line 72
- class-const ReindexTarget::Database() line 72
public function deriveStatement(Derivation $derivation): voidResolves the table of REINDEX TABLE and reports what REINDEX rejects.
Parameters
$derivation | Derivation |
Calls 18
- method-call OptionRules::derive() line 81
- new OptionRules line 81
- class-const ReindexTarget::System() line 82
- method-call OptionArguments::enabled() line 82
- new OptionArguments line 82
- method-call Derivation::report() line 83
- new UtilityProblem line 83
- class-const UtilityProblemKind::SystemConcurrently() line 83
- class-const ReindexTarget::Table() line 85
- new RelationKinds line 86
- method-call RelationKinds::of() line 87
- method-call Derivation::target() line 87
- method-call Targets::resolve() line 87
- new Targets line 87
- method-call RelationKinds::require() line 88
- class-const RelationKind::BaseTable() line 88
- class-const RelationKind::MaterializedView() line 88
- class-const KindRule::NotTableOrMaterializedView() line 88
public function render(Output $out): voidWrites the request.
Parameters
$out | Output |
Calls 8
- method-call Output::keyword() line 97
- method-call OptionRules::write() line 98
- new OptionRules line 98
- class-const OptionSyntax::Parenthesized() line 98
- method-call Spelling::qualified() line 104
- new Spelling line 104
- method-call Output::name() line 106
- class-const NameUse::Column() line 106
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
Other tests reaching this symbol 2
Relations§
Instantiated in 3
- new SqlSemantics\Platform\PostgreSql\Lowering\Utility\MaintenanceRule::statement() packages/sql-semantics-postgres/src/Lowering/Utility/MaintenanceRule.php:107
- new SqlSemantics\Platform\PostgreSql\Lowering\Utility\MaintenanceRule::statement() packages/sql-semantics-postgres/src/Lowering/Utility/MaintenanceRule.php:108
- new SqlSemantics\Platform\PostgreSql\Lowering\Utility\MaintenanceRule::statement() packages/sql-semantics-postgres/src/Lowering/Utility/MaintenanceRule.php:109