Commit cf93b0dc authored by Benjamin Eberlei's avatar Benjamin Eberlei

Quote identifier if its a keyword in the given platform

parent 576eae09
......@@ -99,7 +99,8 @@ abstract class AbstractAsset
*/
public function getQuotedName(AbstractPlatform $platform)
{
return ($this->_quoted) ? $platform->quoteIdentifier($this->_name) : $this->_name;
$keywords = $platform->getReservedKeywordsList();
return ($this->_quoted || $keywords->isKeyword($this->_name)) ? $platform->quoteIdentifier($this->_name) : $this->_name;
}
/**
......
......@@ -149,7 +149,7 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$this->assertEquals(
array(
"CREATE TABLE dbal91_something (id INT NOT NULL, table INT DEFAULT NULL, PRIMARY KEY(id))",
"CREATE TABLE dbal91_something (id INT NOT NULL, \"table\" INT DEFAULT NULL, PRIMARY KEY(id))",
"CREATE INDEX IDX_A9401304ECA7352B ON dbal91_something (\"table\")",
),
$this->_conn->getDatabasePlatform()->getCreateTableSQL($table)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment