Skip to content

Commit b1df44e

Browse files
Copilotabnegate
andauthored
fix(schema): guard ClickHouse index loops against non-skip index types
Agent-Logs-Url: https://github.com/utopia-php/query/sessions/498037f0-05ae-40ad-8dfa-b72fe523705a Co-authored-by: abnegate <5857008+abnegate@users.noreply.github.com>
1 parent a3fcc2b commit b1df44e

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/Query/Schema/ClickHouse.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ public function compileAlter(Table $table): Statement
125125
}
126126

127127
foreach ($table->indexes as $index) {
128+
if ($index->type !== IndexType::Index) {
129+
throw new UnsupportedException(
130+
'Only data-skipping indexes (index()) are supported in ClickHouse ALTER TABLE.'
131+
);
132+
}
128133
$alterations[] = 'ADD ' . $this->compileSkipIndex($index);
129134
}
130135

@@ -176,6 +181,11 @@ public function compileCreate(Table $table, bool $ifNotExists = false): Statemen
176181
}
177182

178183
foreach ($table->indexes as $index) {
184+
if ($index->type !== IndexType::Index) {
185+
throw new UnsupportedException(
186+
'Only data-skipping indexes (index()) are supported in ClickHouse CREATE TABLE.'
187+
);
188+
}
179189
$columnDefs[] = $this->compileSkipIndex($index);
180190
}
181191

0 commit comments

Comments
 (0)