diff --git a/core/Listener/AddMissingIndicesListener.php b/core/Listener/AddMissingIndicesListener.php index 27880fabeac9a..f1d93218a411e 100644 --- a/core/Listener/AddMissingIndicesListener.php +++ b/core/Listener/AddMissingIndicesListener.php @@ -12,11 +12,16 @@ use OCP\DB\Events\AddMissingIndicesEvent; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; +use OCP\IDBConnection; /** * @template-implements IEventListener */ class AddMissingIndicesListener implements IEventListener { + public function __construct( + private readonly IDBConnection $connection, + ) { + } public function handle(Event $event): void { if (!($event instanceof AddMissingIndicesEvent)) { @@ -54,12 +59,14 @@ public function handle(Event $event): void { 'fs_size', ['size'] ); - $event->addMissingIndex( - 'filecache', - 'fs_storage_path_prefix', - ['storage', 'path'], - ['lengths' => [null, 64]] - ); + if ($this->connection->getDatabaseProvider() !== IDBConnection::PLATFORM_POSTGRES) { + $event->addMissingIndex( + 'filecache', + 'fs_storage_path_prefix', + ['storage', 'path'], + ['lengths' => [null, 64]] + ); + } $event->addMissingIndex( 'filecache', 'fs_parent',