[DBAL-91] orm:convert-mapping SchemaException on Postgres reserved words Created: 10/Jan/11 Updated: 12/Feb/11 Resolved: 12/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine DBAL |
| Component/s: | Schema Managers |
| Affects Version/s: | 2.0 |
| Fix Version/s: | 2.0.2, 2.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Emil | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
CentOs 5.5, Postgres 8.1.22 |
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
While execuiting doctrine orm:convert-mapping --from-database yml /tmp/test.yml I get presented an error [Doctrine\DBAL\Schema\SchemaException] The index "type" is quoted because this is a reserved word in Postgres. for example see the following definition: FOREIGN KEY (something) REFERENCES somethings(id) ON UPDATE CASCADE Only type will be quoted because it is a reserved word. |
| Comments |
| Comment by Benjamin Eberlei [ 10/Jan/11 ] |
|
You have to quote with `` in Doctrine. That is translated to the underyling vendor quotation signs. |
| Comment by Emil [ 10/Jan/11 ] |
|
@benjamin this considers a mapping error from database (Postgres) to YAML through the doctrine commandline tool, I do not think your comment is relevant for this issue. |
| Comment by Benjamin Eberlei [ 11/Jan/11 ] |
|
@Emil it is, are you quoting the reserved word in the YML file using `` ? DBAL has some logic to fix escaping in these cases. |
| Comment by Emil [ 11/Jan/11 ] |
|
@benjamin uhm, I might be baffled with the complexity of Doctrine or just plain wrong. But I'm trying to create a YML file from my database. How can I be making a mistake in the YML file with quotes? The error message is presented because the Dcotrine ORM module tries to generate index names on columns, based on the database schema, but fails because the returned names (from the database schema) contain quotes (because they are reserved words). |
| Comment by Benjamin Eberlei [ 11/Jan/11 ] |
|
Sorry, now i get it. I didnt relaize the usecase you were applying. Yes you are right |
| Comment by Benjamin Eberlei [ 23/Jan/11 ] |
|
Can you give me an Example Postgresql Schema with DDL SQL that produces this error? |
| Comment by Emil [ 10/Feb/11 ] |
|
These are the table creation for a test table which is able to reproduce the error. |
| Comment by Emil [ 10/Feb/11 ] |
|
I hope this is enough information. The attached SQL reproduces the following error:
[Doctrine\DBAL\Schema\SchemaException] orm:convert-mapping [--filter="..."] [--from-database] [- |
| Comment by Benjamin Eberlei [ 12/Feb/11 ] |
|
I can't reproduce it Can you run the command with --verbose ? Additionally in lib/Doctrine/ORM/Tools/Console/Command/ConvertMappingCommand.php can you var_dump() $metadata after line 119? |
| Comment by Benjamin Eberlei [ 12/Feb/11 ] |
|
Ok i could reproduce it now. Input is not a keyword for me though, type also not. Coudl reproduce it with "table" |
| Comment by Benjamin Eberlei [ 12/Feb/11 ] |
|
Ok, this is a DBAL issue. |
| Comment by Benjamin Eberlei [ 12/Feb/11 ] |
|
This is fixed and will be included in 2.0.2 |
[DBAL-88] MySqlPlatform not escaping table names Created: 10/Feb/11 Updated: 26/Feb/11 Resolved: 26/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine DBAL |
| Component/s: | Platforms |
| Affects Version/s: | 2.0 |
| Fix Version/s: | 2.0.2, 2.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | James Reed | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
Methods in the MySql Platform that use the table name are not escaping the table name. This causes problems when your table name is the same as a reserved word in MySql. Example: public function getListTableConstraintsSQL($table) { return 'SHOW INDEX FROM ' . $table; }If my table name is User this method will fail and cause a SQL error because the word User is a reserved word in MySql. You need to escape the table name with backticks to prevent these errors. Example: public function getListTableConstraintsSQL($table) { return 'SHOW INDEX FROM `' . $table . '`'; }I encountered this problem while reverse engineering my existing MySql database. I've attached a fixed version that solved my reverse engineering problems. |
| Comments |
| Comment by Benjamin Eberlei [ 11/Feb/11 ] |
|
Duplicate of DDC-976 |
| Comment by Benjamin Eberlei [ 12/Feb/11 ] |
|
This issue is not a duplicate, only related to |
| Comment by Benjamin Eberlei [ 26/Feb/11 ] |
|
Fixed |
[DBAL-87] Undefined variable printer in DBAL Import Command Created: 09/Feb/11 Updated: 11/Feb/11 Resolved: 11/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine DBAL |
| Component/s: | None |
| Affects Version/s: | 2.0.1 |
| Fix Version/s: | 2.0.2 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Rob Squires | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
PHP Version => 5.3.3-1ubuntu9.3 |
||
| Description |
|
When running dbal:import, I receive the following error : Undefined variable: printer in /frameworks/doctrine-orm/Doctrine/DBAL/Tools/Console/Command/ImportCommand.php on line 113 113 : $printer->writeln('OK!'); Other output is implemented using $output->write(); |
| Comments |
| Comment by Benjamin Eberlei [ 11/Feb/11 ] |
|
Fixed. |
[DBAL-86] Documentation tells about setCustomTypes() but the method doesn't actually exist Created: 04/Feb/11 Updated: 27/Feb/11 Resolved: 27/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine DBAL |
| Component/s: | None |
| Affects Version/s: | 2.0.0-BETA2, 2.0.0-BETA3, 2.0.0-BETA4, 2.0.0-RC1-RC3, 2.0-RC4, 2.0-RC5, 2.0, 2.0.1 |
| Fix Version/s: | 2.0.2 |
| Type: | Documentation | Priority: | Minor |
| Reporter: | Boris Guéry | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Quote: When you have implemented the type you still need to let Doctrine know about it. This can be achieved through the Doctrine\DBAL\Configuration#setCustomTypes(array $types) method. Doctrine\ORM\Configuration is a subclass of Doctrine\DBAL\Configuration, so the methods are available on your ORM Configuration instance as well. The method seems to have been removed on this commit 354ede |
| Comments |
| Comment by Benjamin Eberlei [ 07/Feb/11 ] |
|
Ah yes, it works like the code snippet right next to this paragraph: <?php // in bootstrapping code // ... use Doctrine\DBAL\Types\Type; // ... // Register my type Type::addType('mytype', 'My\Project\Types\MyType'); |
| Comment by Benjamin Eberlei [ 27/Feb/11 ] |
|
Fixed. |
[DBAL-85] Illegal quotes in SHOW FULL TABLES WHERE Table_type = "BASE TABLE" Created: 04/Feb/11 Updated: 11/Feb/11 Resolved: 11/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine DBAL |
| Component/s: | Platforms |
| Affects Version/s: | None |
| Fix Version/s: | 2.0.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Karsten Dambekalns | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
When trying to generate update SQL on MySQL running in ANSI SQL mode you get the error: This is caused by the use of identifier quotes (") instead of literal quotes (') in the query This is in MySqlPlatform#getListTablesSQL() |
| Comments |
| Comment by Bernhard Schlas [ 07/Feb/11 ] |
|
Here is a temporary dirty patch for this problem. ONLY FOR TESTING PURPOSE!!! |
| Comment by Karsten Dambekalns [ 08/Feb/11 ] |
|
Why not simply change MySqlPlatform#getListTablesSQL()? |
| Comment by Bernhard Schlas [ 08/Feb/11 ] |
|
Because did this quick and dirty patch before i read this issue. Actually i've attached a better one, |
| Comment by Karsten Dambekalns [ 09/Feb/11 ] |
|
With this change it works for me. |
| Comment by Benjamin Eberlei [ 11/Feb/11 ] |
|
Fixed. |
[DBAL-84] Long string fields are being silently changed to 255 characters in the schema Created: 31/Jan/11 Updated: 20/Feb/11 Resolved: 20/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine DBAL |
| Component/s: | Schema Managers |
| Affects Version/s: | 2.0, 2.0.1 |
| Fix Version/s: | 2.0.2, 2.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Oleg Anashkin | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I have an entity like this: /**
* @orm:Entity
*/
class Product
{
/**
* @orm:Id
* @orm:Column(name="Merchant",type="string",length=50)
*/
protected $merchant;
/**
* @orm:Column(name="Name",type="string",length=500)
*/
protected $name;
}
When I change the length of $name field to 4000 it updates the schema like it is supposed to: php.exe -f console doctrine:schema:update --dump-sql But when I change the length to 5000 it just silently without any warning uses value 255 instead: php.exe -f console doctrine:schema:update --dump-sql I had to look into actual table definition using mysql browser to find this issue because doctrine doesn't even warn about it. This could lead to some pretty serious bugs! |
| Comments |
| Comment by Benjamin Eberlei [ 20/Feb/11 ] |
|
Fixed in master and 2.0.x |