Skip to content

Column comment incorrectly introspected on SQLite #3937

Closed
@morozov

Description

Bug Report

Q A
BC Break no
Version 2.10.1

Summary

If a column without a comment follows a column with a comment that follows another column, then the first column comment is introspected with the value of the second column:

How to reproduce

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Schema\Table;

$conn = DriverManager::getConnection([
    'driver' => 'pdo_sqlite',
    'dbname' => 'sqlite::memory:',
]);

$table = new Table('test');
$table->addColumn('col1', 'string', ['length' => 16]);
$table->addColumn('col2', 'string', ['length' => 16, 'comment' => 'Column #2']);
$table->addColumn('col3', 'string', ['length' => 16]);

$sm = $conn->getSchemaManager();
$sm->createTable($table);

$comment = $sm->listTableDetails('test')
    ->getColumn('col1')
    ->getComment();

var_dump($comment);

// string(9) "Column #2"

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions